Skip to content

Conversation

@bhargavkathivarapu
Copy link
Contributor

Relates to #950

For unit test copied the test for , I copied the existing one and passed Path object .
Didn't do any factoring as it fetching parameters of test case

@bhargavkathivarapu
Copy link
Contributor Author

@vincentqb , The newly added testcases test_apply_effects_str , test_apply_effects_path under sox_effect_test.py ran successfully . But exisiting torchscript tests failed for test_apply_effect_file , from error message it seems Union Type is causing the issue

@vincentqb
Copy link
Contributor

Thanks for catching this: unfortunately, jit does not support Union type, pytorch/pytorch#41412. This means we won't be able to support path also with this function here until pytorch/pytorch#41412 is resolved.

Thanks for opening this pull request, we can keep it open in case pytorch/pytorch#41412 gets resolved and we would then be able to merge it even though this may take some time.

@vincentqb vincentqb mentioned this pull request Nov 19, 2020
16 tasks
Copy link
Contributor

@vincentqb vincentqb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll mark this as "changed needed" until pytorch/pytorch#41412 is resolved, thanks for opening this and noticing the issue :)

load_params("sox_effect_test_args.json"),
name_func=lambda f, i, p: f'{f.__name__}_{i}_{p.args[0]["effects"][0][0]}',
)
def test_apply_effects_path(self, args):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overkill for testing the Pathlib.Path compatibility. Can you just pick up one test case, so that the focus of the test is intuitively clear that it's about Pathlib.Path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mthrok changed the pathlib unit test by hard coding a specific test case argument

@_mod_utils.requires_module('torchaudio._torchaudio')
def apply_effects_file(
path: str,
path: Union[str, Path],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the Union and just use str, but explaining why in the docstring which is how it is done in sox_io.

Copy link
Contributor

@vincentqb vincentqb Nov 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I second this, and we should be able to see if the command is jitable :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincentqb changed type as per sox_io.
Also used str() like sox_io to convert Path to string, as os.fspath() is not supported by torchscript.
Now all checks passed.

Copy link
Contributor

@vincentqb vincentqb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@vincentqb vincentqb merged commit dc3c5c5 into pytorch:master Nov 20, 2020
mthrok pushed a commit to mthrok/audio that referenced this pull request Dec 13, 2022
mpc001 pushed a commit to mpc001/audio that referenced this pull request Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants