[pipeline] fix padding for 1-d tensors (#31776)
* [pipeline] fix padding for 1-d tensors * add test * make style * Update tests/pipelines/test_pipelines_automatic_speech_recognition.py Co-authored-by: Kamil Akesbi <45195979+kamilakesbi@users.noreply.github.com> * Update tests/pipelines/test_pipelines_automatic_speech_recognition.py --------- Co-authored-by: Kamil Akesbi <45195979+kamilakesbi@users.noreply.github.com>
This commit is contained in:
@@ -549,6 +549,23 @@ class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase):
|
||||
output = speech_recognizer([filename], chunk_length_s=5, batch_size=4)
|
||||
self.assertEqual(output, [{"text": " A man said to the universe, Sir, I exist."}])
|
||||
|
||||
@require_torch
|
||||
@slow
|
||||
def test_torch_whisper_batched(self):
|
||||
speech_recognizer = pipeline(
|
||||
task="automatic-speech-recognition",
|
||||
model="openai/whisper-tiny",
|
||||
framework="pt",
|
||||
)
|
||||
ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation[:2]")
|
||||
EXPECTED_OUTPUT = [
|
||||
{"text": " Mr. Quilter is the apostle of the middle classes and we are glad to welcome his gospel."},
|
||||
{"text": " Nor is Mr. Quilters' manner less interesting than his matter."},
|
||||
]
|
||||
|
||||
output = speech_recognizer(ds["audio"], batch_size=2)
|
||||
self.assertEqual(output, EXPECTED_OUTPUT)
|
||||
|
||||
@slow
|
||||
def test_find_longest_common_subsequence(self):
|
||||
max_source_positions = 1500
|
||||
|
||||
Reference in New Issue
Block a user