From b5bab710f79af69002c52467cd39ee3c85c32e04 Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Thu, 16 Sep 2021 09:07:20 +0200 Subject: [PATCH] correct (#13585) --- .../test_feature_extraction_speech_to_text.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/test_feature_extraction_speech_to_text.py b/tests/test_feature_extraction_speech_to_text.py index ecc0116652..73522bcc07 100644 --- a/tests/test_feature_extraction_speech_to_text.py +++ b/tests/test_feature_extraction_speech_to_text.py @@ -137,11 +137,15 @@ class Speech2TextFeatureExtractionTest(SequenceFeatureExtractionTestMixin, unitt feature_extractor = self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()) speech_inputs = [floats_list((1, x))[0] for x in range(800, 1400, 200)] - paddings = ["longest", "max_length", "do_not_pad"] - max_lengths = [None, 16, None] - var_tolerances = [1e-3, 1e-3, 5e-1] # TODO(Patrick, Suraj, Anton) - It's surprising that "non-padded/non-numpified" padding # results in quite inaccurate variance computation after (see 5e-1 tolerance) + # Issue is filed and PR is underway: https://github.com/huggingface/transformers/issues/13539 + # paddings = ["longest", "max_length", "do_not_pad"] + # max_lengths = [None, 16, None] + # var_tolerances = [1e-3, 1e-3, 5e-1] + paddings = ["longest", "max_length"] + max_lengths = [None, 16] + var_tolerances = [1e-3, 1e-3] for max_length, padding, var_tol in zip(max_lengths, paddings, var_tolerances): inputs = feature_extractor( @@ -163,11 +167,15 @@ class Speech2TextFeatureExtractionTest(SequenceFeatureExtractionTestMixin, unitt feature_extractor = self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()) speech_inputs = [floats_list((1, x))[0] for x in range(800, 1400, 200)] - paddings = ["longest", "max_length", "do_not_pad"] - max_lengths = [None, 16, None] - var_tolerances = [1e-3, 1e-3, 5e-1] # TODO(Patrick, Suraj, Anton) - It's surprising that "non-padded/non-numpified" padding # results in quite inaccurate variance computation after (see 5e-1 tolerance) + # Issue is filed and PR is underway: https://github.com/huggingface/transformers/issues/13539 + # paddings = ["longest", "max_length", "do_not_pad"] + # max_lengths = [None, 16, None] + # var_tolerances = [1e-3, 1e-3, 5e-1] + paddings = ["longest", "max_length"] + max_lengths = [None, 16] + var_tolerances = [1e-3, 1e-3] for max_length, padding, var_tol in zip(max_lengths, paddings, var_tolerances): inputs = feature_extractor( speech_inputs, max_length=max_length, padding=padding, return_tensors="np", return_attention_mask=True