-
Notifications
You must be signed in to change notification settings - Fork 667
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 fbank #672
Migrate kaldi fbank #672
Conversation
Signed-off-by: Bhargav Kathivarapu <[email protected]>
Signed-off-by: Bhargav Kathivarapu <[email protected]>
Thanks for working on this! I tried your change and it almost worked. Here is the fix I suggest. (Note that you need to re-add
diff --git a/test/kaldi_compatibility_impl.py b/test/kaldi_compatibility_impl.py
index aed5a35..880004d 100644
--- a/test/kaldi_compatibility_impl.py
+++ b/test/kaldi_compatibility_impl.py
@@ -1,4 +1,5 @@
"""Test suites for checking numerical compatibility against Kaldi"""
+import json
import shutil
import unittest
import subprocess
@@ -9,8 +10,7 @@ import torchaudio.functional as F
import torchaudio.compliance.kaldi
from . import common_utils
-from parameterized import parameterized
-import json
+from parameterized import parameterized, param
def _not_available(cmd):
@@ -49,9 +49,9 @@ def _run_kaldi(command, input_type, input_value):
return torch.from_numpy(result.copy()) # copy supresses some torch warning
-def _load_jsonl(path):
+def _load_params(path):
with open(path, 'r') as file:
- return [json.loads(line) for line in file]
+ return [param(json.loads(line)) for line in file]
class Kaldi(common_utils.TestBaseMixin):
@@ -75,8 +75,8 @@ class Kaldi(common_utils.TestBaseMixin):
kaldi_result = _run_kaldi(command, 'ark', tensor)
self.assert_equal(result, expected=kaldi_result)
+ @parameterized.expand(_load_params(common_utils.get_asset_path('kaldi_test_fbank_args.json')))
@unittest.skipIf(_not_available('compute-fbank-feats'), '`compute-fbank-feats` not available')
- @parameterized.expand(_load_jsonl(common_utils.get_asset_path('kaldi_test_fbank_args.json')))
def test_fbank(self, kwargs):
"""fbank should be numerically compatible with compute-fbank-feats"""
wave_file = common_utils.get_asset_path('kaldi_file.wav') |
Signed-off-by: Bhargav Kathivarapu <[email protected]>
@mthrok , Made the changes Old complaince kaldi test is using rtol=1e-1 and atol=1e-3 for fbank , should we change the threshold to this ?? |
Looking at the log, most of them are still close enough, but one of them looks way off.
I think some values are out of expected range, which makes me question the validity of the original test.
Looking at the default values, some values are very far from default. |
@mthrok From the fbank argument generation script present at Below configuration is used to generate for those 3 args :
Not sure about the exact range of values that these arguments must take |
So I got the advice from some experienced Kaldi user,
So I think that parameters failing are not valid use cases. We should remove them. |
Signed-off-by: Bhargav Kathivarapu <[email protected]>
Signed-off-by: Bhargav Kathivarapu <[email protected]>
@mthrok , Removed those 9 failing cases from JSON . Now all unit tests passed |
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.
Looks good, thanks!
@bhargavkathivarapu I forgot to add but can you do the honor to remove the migrated tests ( |
yeah , will remove all compliance files at once , after all tests are migrated |
* fix: Namespace issue of Reduction in CPP MNIST - Changed the at::Reduction::Sum into Reduction::Sum Solved issue pytorch#672 Signed-off-by: Arkadip <[email protected]> * Update cpp/mnist/mnist.cpp Co-Authored-By: Will Feng <[email protected]> Co-authored-by: Will Feng <[email protected]>
Hi ,
This PR migrates the kaldi fbank test (#597 ) from test/test_compliance_kaldi.py to test/kaldi_compatibility_impl.py