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
Migrate kaldi spectrogram #687
Conversation
Signed-off-by: Bhargav Kathivarapu <bhargavkathivarapu31@gmail.com>
Signed-off-by: Bhargav Kathivarapu <bhargavkathivarapu31@gmail.com>
Signed-off-by: Bhargav Kathivarapu <bhargavkathivarapu31@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #687 +/- ##
=======================================
Coverage 88.79% 88.80%
=======================================
Files 22 22
Lines 2356 2358 +2
=======================================
+ Hits 2092 2094 +2
Misses 264 264
Continue to review full report at Codecov.
|
@mthrok , Applied device and dtype patch to kaldi spectrogram function in kaldi.py . Removed the failing test cases . |
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.
Mostly looks good.
torchaudio/compliance/kaldi.py
Outdated
@@ -284,10 +287,10 @@ def spectrogram(waveform: Tensor, | |||
snip_edges, raw_energy, energy_floor, dither, remove_dc_offset, preemphasis_coefficient) | |||
|
|||
# size (m, padded_window_size // 2 + 1, 2) | |||
fft = torch.rfft(strided_input, 1, normalized=False, onesided=True) | |||
fft = torch.rfft(strided_input, 1, normalized=False, onesided=True).to(dtype=dtype, device=device) |
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.
This change does not seem to be necessary.
strided_input
and fft
should be already on the right dtype/device.
I tried your code without this change and tests ran fine.
Did you find a case this causes RuntimeError
?
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.
Reverted this change,unittest passed.
Before I got runtime error at torch.max step , so safe side I changed device and dtype for inputs to max
I tried running it with CUDA and
|
Signed-off-by: Bhargav Kathivarapu <bhargavkathivarapu31@gmail.com>
Removed those 2 tests and reverted the device change for fft step |
Looks good and verified all tests pass on CUDA. Thanks! |
Reinstate torchaudio tutorial
This PR migrates the kaldi spectrogram test (#597 ) from test/test_compliance_kaldi.py to test/kaldi_compatibility_impl.py