Skip to content

Commit

Permalink
Rename nlp.
Browse files Browse the repository at this point in the history
  • Loading branch information
Narsil committed Jun 17, 2021
1 parent cf76d45 commit 0310aea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_pipelines_automatic_speech_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ def test_pt_defaults(self):
def test_torch_small(self):
import numpy as np

nlp = pipeline(
speech_recognizer = pipeline(
task="automatic-speech-recognition",
model="facebook/s2t-small-mustc-en-fr-st",
tokenizer="facebook/s2t-small-mustc-en-fr-st",
framework="pt",
)
waveform = np.zeros((34000,))
output = nlp(waveform)
output = speech_recognizer(waveform)
self.assertEqual(output, {"text": "C'est ce que j'ai fait à ce moment-là."})

@require_datasets
Expand All @@ -50,21 +50,21 @@ def test_torch_small(self):
def test_torch_large(self):
import numpy as np

nlp = pipeline(
speech_recognizer = pipeline(
task="automatic-speech-recognition",
model="facebook/wav2vec2-base-960h",
tokenizer="facebook/wav2vec2-base-960h",
framework="pt",
)
waveform = np.zeros((34000,))
output = nlp(waveform)
output = speech_recognizer(waveform)
self.assertEqual(output, {"text": ""})

from datasets import load_dataset

ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
filename = ds[0]["file"]
output = nlp(filename)
output = speech_recognizer(filename)
self.assertEqual(output, {"text": "A MAN SAID TO THE UNIVERSE SIR I EXIST"})

@slow
Expand Down

0 comments on commit 0310aea

Please sign in to comment.