Views
No views yet
| File | Description | Size |
|---|---|---|
model.onnx | ONNX model (Conformer encoder + CTC decoder) | ~507 MB |
tokens.txt | BPE vocabulary (128 tokens + blank) | 933 bytes |
1import sherpa_onnx
2import soundfile as sf
3
4recognizer = sherpa_onnx.OfflineRecognizer.from_nemo_ctc(
5 model="model.onnx",
6 tokens="tokens.txt",
7 num_threads=4,
8)
9
10audio, sample_rate = sf.read("audio.wav")
11stream = recognizer.create_stream()
12stream.accept_waveform(sample_rate, audio)
13recognizer.decode_stream(stream)
14
15print(stream.result.text)1import nemo.collections.asr as nemo_asr
2from huggingface_hub import hf_hub_download
3
4# Download original NeMo model
5nemo_path = hf_hub_download(
6 repo_id="nvidia/stt_ca_conformer_ctc_large",
7 filename="stt_ca_conformer_ctc_large.nemo"
8)
9
10# Load and export
11m = nemo_asr.models.EncDecCTCModel.restore_from(nemo_path)
12m.eval()
13
14# Export tokens (BPE vocabulary)
15vocab_size = m.tokenizer.vocab_size
16with open("tokens.txt", "w", encoding="utf-8") as f:
17 for i in range(vocab_size):
18 token = m.tokenizer.ids_to_tokens([i])[0]
19 f.write(f"{token} {i}\n")
20 f.write(f"<blk> {vocab_size}\n")
21
22# Export ONNX model
23m.export("model.onnx")nemo_toolkit[asr]torch<2.6 (for ONNX export compatibility)onnxhuggingface_hub' - a b c d e f g h i j k l m n o p q r s t u v w x y z · à á ç è é í ï ñ ò ó ú ü ı – —| Tokenizer | Vocabulary Size | Dev WER | Test WER | Dataset |
|---|---|---|---|---|
| SentencePiece Unigram | 128 | 4.70% | 4.27% | MCV-9.0 |