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
Use parametrize and set random seed in functional batch consistency test #1341
Conversation
Don't test every combination of `center` and `norm_vars` at the same time - generate separate tests.
functional/batch_consistency_test.py
Hi @jcaw Thanks for the PR. It overall looks good.
👍
Thanks for catching this. It was an oversight. Let's create a PR for fixing the argument name. It is a BC-breaking change so we might get push back but I think that is the right thing to do.
I see. I did not review the design of Anyways, having this change blocks this PR, while the other changes are good improvement. So can you revert the change regards this VAD test failure and file an issue to keep the discussion?
While I was skimming through the change, I thought the random tensors were all waveforms, (which was wrong), so I asked if you could change it to |
142bb19
to
575f482
Compare
No worries, glad to help.
Ah, good point. Ok, I'll create that separately.
Certainly. I've removed the two VAD commits and force-pushed (I've just removed work, nothing added). I'll file an issue shortly. (Edit: force pushing seems to have scrubbed the original branch state from the PR, sorry about that. I thought GitHub kept both around. I've copied it here for reference.)
Awesome!
Ok, that makes sense. Would you like me to introduce the |
Hi @jcaw I think this PR is good enough improvement so I am going to merge this now. Please open up a new PR. BTW we released torchaudio 0.8.0 which includes your fix on |
functional/batch_consistency_test.py
No worries! |
Co-authored-by: Brian Johnson <brianjo@fb.com>
This PR adds a number of miscellaneous changes to
functional/batch_consistency_test.py
. They are as follows:Parameterize
test_sliding_window_cmn
so separate tests are generated (also extract the test naming function).F.sliding_window_cmn
should take a spectrogram, so replace the wave with a spectrogram. (Related to this,F.sliding_window_cmn
currently refers to its spectrogram parameter aswaveform
. Would you like me to change it tospec
?)Set the manual seed in a couple of places it was missing.
Tweak the VAD consistency tests by using longer samples for the random test, and using lower thresholds for the file test. This now causes many of the VAD tests to fail.
This has me thinking - if the purpose of
F.vad
is to outright crop the input tensor (not, for example, zero it), shouldn't we expect it to produce different results on a sample vs. a batch? I believe my tweaks just contain the right conditions for that to happen, but I might be misreading. If this is the case, shouldF.vad
be removed from the batch consistency tests?In #1315, @mthrok also mentioned switching the tensor creation to
get_whitenoise
. I've done this on another branch by introducing a new functionget_whitenoise_batch
- I wasn't sure if this was the approach you would prefer so I've left it out for now. (For example, I could perhaps add an optionaln_items
parameter toget_whitenoise
which returns a batch iff provided, although that seems messy). I can append those changes to this PR too, and introduce a similaradd_spectrogram
function if that's also desirable.