Skip to content

Conversation

@mthrok
Copy link
Contributor

@mthrok mthrok commented Jul 16, 2020

@mthrok mthrok force-pushed the doc-backend branch 2 times, most recently from 5d4b7d9 to f983586 Compare July 16, 2020 03:36
@codecov
Copy link

codecov bot commented Jul 16, 2020

Codecov Report

Merging #788 into master will decrease coverage by 0.14%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #788      +/-   ##
==========================================
- Coverage   89.89%   89.75%   -0.15%     
==========================================
  Files          35       34       -1     
  Lines        2712     2655      -57     
==========================================
- Hits         2438     2383      -55     
+ Misses        274      272       -2     
Impacted Files Coverage Δ
torchaudio/backend/common.py 100.00% <ø> (ø)
torchaudio/functional.py 95.32% <ø> (ø)
torchaudio/models/wav2letter.py 100.00% <ø> (ø)
torchaudio/transforms.py 95.77% <ø> (ø)
torchaudio/utils/sox_utils.py 100.00% <ø> (ø)
torchaudio/backend/sox_io_backend.py 76.47% <75.00%> (-1.66%) ⬇️
torchaudio/__init__.py 73.33% <100.00%> (ø)
torchaudio/backend/utils.py 89.13% <100.00%> (ø)
torchaudio/sox_effects/sox_effects.py 95.23% <100.00%> (ø)
torchaudio/datasets/gtzan.py 75.92% <0.00%> (-4.38%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 937d52f...6c6512a. Read the comment docs.

@mthrok mthrok force-pushed the doc-backend branch 6 times, most recently from 0818a1d to 28de9fb Compare July 16, 2020 16:51
@mthrok mthrok marked this pull request as ready for review July 16, 2020 16:56
@mthrok mthrok requested a review from vincentqb July 16, 2020 16:56

.. warning::
Although ``sox`` backend is default for backward compatibility reason, it has a number of issues, therefore it is highly recommended to use ``sox_io`` backend instead. Note, however, that due to the interface refinement, functions defined in ``sox`` backend and those defined in ``sox_io`` backend do not have the signatures.
Although ``sox`` backend is default for backward compatibility reason, it has a number of issues, therefore it is highly recommended to use ``sox_io`` backend instead. Note, however, that due to the interface refinement, functions defined in ``sox`` backend and those defined in ``sox_io`` backend do not have the same signatures.
Copy link
Contributor

@vincentqb vincentqb Jul 16, 2020

Choose a reason for hiding this comment

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

Actually, let's simplify the statement:

sox backend is currently the default for backward compatibility reason. It is recommended to migrate to sox_io backend, and use its new interface, which will become the default in a future version. See here for more information about how to migrate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's better to do that after we figure out the plan for deprecation of sox backend.

Copy link
Contributor

@vincentqb vincentqb Jul 16, 2020

Choose a reason for hiding this comment

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

My point is mostly to remove the idea of "issues", "interface refinement". How about this then?

sox backend is the default for backward compatibility reason, but it is recommended to use sox_io backend instead. Note, however, functions defined in sox backend and those defined in sox_io backend do not have the same signatures.

Although sox backend is default for backward compatibility reason, it has a number of issues, therefore it is highly recommended to use sox_io backend instead. Note, however, that due to the interface refinement, functions defined in sox backend and those defined in sox_io backend do not have the signatures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My point here is to discourage users to use sox backend and raise the awareness of the danger of using it. If we are not upfront of issues, users would not take efforts to migrate because it takes engineering efforts to do so.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate on "dangers"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As it's summarized in #726

sox backend does not load wav files other than 16-bit signed integer, save function does not preserve data, info returns the number of samples instead of the number of frames. This affects every aspect of ML application, from training to inference. There is always chance to introduce wrong data when using load and if one works on generative models, save function does not correctly save the data.

Ideally we should fix it but the inconsistent design and band aides placed in a wrong place to fix the issue(load_wav), it's very difficult to do that now without breaking BC.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the clarification. I understand what you mean though I don't think this is the correct wording. Since I do not want to block this change here for this, I'll approve the pull request.



def set_audio_backend(backend: Optional[str]) -> None:
def set_audio_backend(backend: Optional[str]):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: why are you removing the typing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This typing is redundant and messed up the documentation rendering.

@mthrok mthrok merged commit 2381dd8 into pytorch:master Jul 20, 2020
@mthrok mthrok deleted the doc-backend branch July 20, 2020 22:31
@mthrok
Copy link
Contributor Author

mthrok commented Jul 20, 2020

thanks!

vincentqb pushed a commit to vincentqb/audio that referenced this pull request Jul 28, 2020
- Addresses pytorch#549 pytorch#638 pytorch#786
- Add `torchaudio` top level module doc
- Separate `torchaudio` top level module doc from `index.html`
- Add `backend` module doc.
- Remove `-> None` from function signature as it adds noise to documentation
- Changed function argument name of `torchaudio.backend.sox_io_backend.save` from `tensor` to `src`, so that it matches with the reset of backends.
- Tweak bunch of docstrings
vincentqb added a commit that referenced this pull request Jul 28, 2020
* Update documentation and fix docstrings (#788)

- Addresses #549 #638 #786
- Add `torchaudio` top level module doc
- Separate `torchaudio` top level module doc from `index.html`
- Add `backend` module doc.
- Remove `-> None` from function signature as it adds noise to documentation
- Changed function argument name of `torchaudio.backend.sox_io_backend.save` from `tensor` to `src`, so that it matches with the reset of backends.
- Tweak bunch of docstrings

* addressing feedback.

Co-authored-by: moto <[email protected]>
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.

2 participants