-
Notifications
You must be signed in to change notification settings - Fork 664
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
Conversation
torchaudio/backend/utils.py
Outdated
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') |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
27ca7d2
to
9896f86
Compare
There was a problem hiding this 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
, inload
andprecision
insave
, I would simply raise a warning if different from default and then remove. - For
normalization=
andoffset=
, 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 :)
9896f86
to
d0d221f
Compare
if compression is not None: | ||
warnings.warn( | ||
'"soundfile" backend\'s `save` function does not support changing compression level. ' | ||
'`compression` argument is silently ignore.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: silently ignored
There was a problem hiding this comment.
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?
elif frame_offset != 0: | ||
offset = frame_offset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can always be done?
There was a problem hiding this 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. ' |
There was a problem hiding this comment.
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, | |||
*, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the *
?
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.') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: deprecated
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.' | ||
) |
There was a problem hiding this comment.
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?
See #903
Superseded by #922