Created
September 21, 2023 02:40
-
-
Save fauxneticien/5c9b748c8bfff6c4f9ad5b2034a8d410 to your computer and use it in GitHub Desktop.
benchmark-fastconformer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torchaudio | |
fakewav_80mins = torch.rand(1, 16_000 * 60 * 80) | |
torchaudio.save("tmp/80mins.wav", fakewav_80mins, 16_000) | |
import nemo.collections.asr as nemo_asr | |
asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(model_name="nvidia/stt_en_fastconformer_ctc_large") | |
asr_model.eval() | |
with torch.inference_mode(): | |
transcriptions = asr_model.transcribe(['tmp/80mins.wav']) | |
# Change to LongFormer-style local attention | |
asr_model.change_attention_model( | |
self_attention_model="rel_pos_local_attn", | |
att_context_size=[128, 128] | |
) | |
with torch.inference_mode(): | |
transcriptions = asr_model.transcribe(['tmp/80mins.wav']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment