

Time-to-WER results, deferring to smaller beam size, across decoders. The TorchAudio + Flashlight decoder scales far better with larger beam sizes and at lower WERs.

TorchAudio API and Usage
TorchAudio provides a Python API for CTC beam search decoding, with support for the following:

lexicon and lexicon-free decoding
KenLM n-gram language model integration
character and word-piece decoding
sample pretrained LibriSpeech KenLM models and corresponding lexicon and token files
various customizable beam search parameters (beam size, pruning threshold, LM weight...)

To set up the decoder, use the factory function torchaudio.models.decoder.ctc_decoder
from torchaudio.models.decoder import ctc_decoder, download_pretrained_files
files = download_pretrained_files("librispeech-4-gram")
decoder = ctc_decoder(
   lexicon=files.lexicon,
   tokens=files.tokens,
   lm=files.lm,
   nbest=1,
   ... additional optional customizable args ...
)
