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

Clean up common_utils #690

Merged
merged 1 commit into from Jun 4, 2020
Merged

Conversation

mthrok
Copy link
Collaborator

@mthrok mthrok commented Jun 4, 2020

This PR

  1. Removes compatibility code for Python < 3.4 from torchaudio.common_utils. Remove PY<3.4 code from common_utils #691
  2. Moves IMPORT_KALDI_IO global variable to kaldi_io module because it's only used there and does not seem to be useful elsewhere.
  3. Moves IMPORT_LIBROSA global variable to test because it's only used in test_librosa_compatibility.py.
  4. Removes IMPORT_NUMPY and IMPORT_SCIPY as they are redundant. (If librosa is available numpy and scipy should be available too, else installation is broken and that's not torchaudio's responsibility to watch out such case.)

@mthrok mthrok marked this pull request as draft June 4, 2020 14:15
@codecov
Copy link

codecov bot commented Jun 4, 2020

Codecov Report

Merging #690 into master will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #690      +/-   ##
==========================================
- Coverage   89.10%   89.08%   -0.03%     
==========================================
  Files          22       22              
  Lines        2341     2336       -5     
==========================================
- Hits         2086     2081       -5     
  Misses        255      255              
Impacted Files Coverage Δ
torchaudio/common_utils.py 100.00% <100.00%> (ø)
torchaudio/kaldi_io.py 88.46% <100.00%> (ø)

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 b56a27b...39bd543. Read the comment docs.

@mthrok mthrok force-pushed the cleanup-common-utils branch 5 times, most recently from 2a4a33b to 6c8b1a5 Compare June 4, 2020 17:13
@mthrok mthrok marked this pull request as ready for review June 4, 2020 17:43
@mthrok mthrok requested a review from vincentqb June 4, 2020 19:36
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.

One question about typing. Otherwise, LGTM.

@@ -1,17 +1,11 @@
import importlib.util


def _check_module_exists(name: str) -> bool:
def _check_module_exists(*modules: str) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the typing for this works? If so, I like it :)

@@ -115,12 +117,8 @@ def test_amplitude_to_DB(self):
])
@pytest.mark.parametrize('rate', [0.5, 1.01, 1.3])
@pytest.mark.parametrize('hop_length', [256])
@unittest.skipIf(not LIBROSA_AVAILABLE, "Librosa not available")
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 addressing comment

@mthrok mthrok merged commit 2416e5d into pytorch:master Jun 4, 2020
@mthrok
Copy link
Collaborator Author

mthrok commented Jun 4, 2020

thanks!

@mthrok mthrok deleted the cleanup-common-utils branch June 4, 2020 20:00
mthrok pushed a commit to mthrok/audio that referenced this pull request Feb 26, 2021
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants