Apply several ruff SIM rules (#37283)
* Apply ruff SIM118 fix Signed-off-by: cyy <cyyever@outlook.com> * Apply ruff SIM910 fix Signed-off-by: cyy <cyyever@outlook.com> * Apply ruff SIM101 fix Signed-off-by: cyy <cyyever@outlook.com> * Format code Signed-off-by: cyy <cyyever@outlook.com> * More fixes Signed-off-by: cyy <cyyever@outlook.com> --------- Signed-off-by: cyy <cyyever@outlook.com>
This commit is contained in:
@@ -122,7 +122,7 @@ class SpeechT5ProcessorTest(unittest.TestCase):
|
||||
input_feat_extract = feature_extractor(audio=raw_speech, return_tensors="np")
|
||||
input_processor = processor(audio=raw_speech, return_tensors="np")
|
||||
|
||||
for key in input_feat_extract.keys():
|
||||
for key in input_feat_extract:
|
||||
self.assertAlmostEqual(input_feat_extract[key].sum(), input_processor[key].sum(), delta=1e-2)
|
||||
|
||||
def test_feature_extractor_target(self):
|
||||
@@ -136,7 +136,7 @@ class SpeechT5ProcessorTest(unittest.TestCase):
|
||||
input_feat_extract = feature_extractor(audio_target=raw_speech, return_tensors="np")
|
||||
input_processor = processor(audio_target=raw_speech, return_tensors="np")
|
||||
|
||||
for key in input_feat_extract.keys():
|
||||
for key in input_feat_extract:
|
||||
self.assertAlmostEqual(input_feat_extract[key].sum(), input_processor[key].sum(), delta=1e-2)
|
||||
|
||||
def test_tokenizer(self):
|
||||
@@ -150,7 +150,7 @@ class SpeechT5ProcessorTest(unittest.TestCase):
|
||||
encoded_processor = processor(text=input_str)
|
||||
encoded_tok = tokenizer(input_str)
|
||||
|
||||
for key in encoded_tok.keys():
|
||||
for key in encoded_tok:
|
||||
self.assertListEqual(encoded_tok[key], encoded_processor[key])
|
||||
|
||||
def test_tokenizer_target(self):
|
||||
@@ -164,7 +164,7 @@ class SpeechT5ProcessorTest(unittest.TestCase):
|
||||
encoded_processor = processor(text_target=input_str)
|
||||
encoded_tok = tokenizer(input_str)
|
||||
|
||||
for key in encoded_tok.keys():
|
||||
for key in encoded_tok:
|
||||
self.assertListEqual(encoded_tok[key], encoded_processor[key])
|
||||
|
||||
def test_tokenizer_decode(self):
|
||||
|
||||
Reference in New Issue
Block a user