Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add expected BC-breaking change warning to soundfile #906

Closed
wants to merge 2 commits into from

Conversation

mthrok
Copy link
Collaborator

@mthrok mthrok commented Sep 10, 2020

See #903

Superseded by #922

Comment on lines 56 to 63
warnings.warn(
'"soundfile" backend is planned to change the function signatures in 0.9.0. '
'Please refer to https://github.com/pytorch/audio/issues/903')
Copy link
Contributor

Choose a reason for hiding this comment

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

When I see a warning like this, I think "Ok, how can I change my code to migrate and suppress the warning?". This warning may give the impression soundfile should not be used, which is not the case.

If we want to warn, then I'd say we should have a mechanism for the user to use the new interface right away.

Copy link
Contributor

Choose a reason for hiding this comment

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

(offline comment on internal document)

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.

As mentioned offline, I'd suggest instead:

  • For out=, signalinfo=, encodinginfo=, filetype, in load and precision in save, I would simply raise a warning if different from default and then remove.
  • For normalization= and offset=, I would simply create the new parameter, and tell user to switch, since it will be removed.

That being said, I'm also ok with the current warning, so I'll approve the PR so you can decide what to do and move forward :)

if compression is not None:
warnings.warn(
'"soundfile" backend\'s `save` function does not support changing compression level. '
'`compression` argument is silently ignore.'
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: silently ignored

Copy link
Contributor

Choose a reason for hiding this comment

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

will this parameter be removed?

Comment on lines +56 to +57
elif frame_offset != 0:
offset = frame_offset
Copy link
Contributor

Choose a reason for hiding this comment

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

can always be done?

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


if compression is not None:
warnings.warn(
'"soundfile" backend\'s `save` function does not support changing compression level. '
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have an issue that gives more detail for this?

@@ -34,8 +35,26 @@ def load(filepath: str,
offset: int = 0,
signalinfo: SignalInfo = None,
encodinginfo: EncodingInfo = None,
filetype: Optional[str] = None) -> Tuple[Tensor, int]:
filetype: Optional[str] = None,
*,
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the *?

Comment on lines +61 to +63
warnings.warn(
'"soundfile" backend is planned to change the function signatures in 0.8.0. '
'Please refer to https://github.com/pytorch/audio/issues/903 for the migration step.')
Copy link
Contributor

Choose a reason for hiding this comment

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

the real issue behind this particular comment is the return type? then it could be specialized to return type?

Copy link
Contributor

@vincentqb vincentqb Sep 25, 2020

Choose a reason for hiding this comment

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

how about a local parameter that controls the return type in the load/save function?

r"""See torchaudio.save"""

if precision:
warnings.warn(
'"precision" argument is depricated and removed in 0.8.0. In 0.8.0, '
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: deprecated

Comment on lines +43 to +46
warnings.warn(
'The return type of `load` function in "soundfile" backend is going to be changed in 0.8.0. '
'Please refer to https://github.com/pytorch/audio/issues/903 for the detail.'
)
Copy link
Contributor

Choose a reason for hiding this comment

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

that's fine to me. next best thing to creating a new backend?

@mthrok mthrok closed this Sep 28, 2020
@mthrok mthrok deleted the warning-soundfile branch September 28, 2020 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants