Commit 0d6d0669 authored by hwangjeff's avatar hwangjeff Committed by Facebook GitHub Bot
Browse files

Add integration test for Emformer RNN-T LibriSpeech pipeline (#2172)

Summary:
Adds integration test for pretrained ASR pipeline `EMFORMER_RNNT_BASE_LIBRISPEECH`.

Pull Request resolved: https://github.com/pytorch/audio/pull/2172

Reviewed By: carolineechen, nateanl

Differential Revision: D33793324

Pulled By: hwangjeff

fbshipit-source-id: d0613e2ab98fe5afa7b16ca39b67f0a0304d13fc
parent b81f0b45
......@@ -29,7 +29,7 @@ jobs:
run: |
python -m pip install --quiet --upgrade pip
python -m pip install --quiet --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
python -m pip install --quiet pytest requests cmake ninja deep-phonemizer
python -m pip install --quiet pytest requests cmake ninja deep-phonemizer sentencepiece
python setup.py install
env:
BUILD_FFMPEG: true
......
import pytest
import torchaudio
from torchaudio.prototype.pipelines import EMFORMER_RNNT_BASE_LIBRISPEECH
@pytest.mark.parametrize(
"bundle,lang,expected",
[(EMFORMER_RNNT_BASE_LIBRISPEECH, "en", "i have that curiosity beside me at this moment")],
)
def test_rnnt(bundle, sample_speech, expected):
feature_extractor = bundle.get_feature_extractor()
decoder = bundle.get_decoder().eval()
token_processor = bundle.get_token_processor()
waveform, _ = torchaudio.load(sample_speech)
features, length = feature_extractor(waveform.squeeze())
hypotheses = decoder(features, length, 10)
text = token_processor(hypotheses[0].tokens)
assert text == expected
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment