Nimaone/nemotron-asr-streaming-farsi-onnx
An ONNX conversion of mehdi-hf/nemotron-asr-streaming-farsi — a 600M-parameter streaming ASR for Persian (fine-tuned from NVIDIA nemotron-3.5-asr-streaming-0.6b) — exported with the official sherpa-onnx pipeline so it runs fully offline on CPU with no PyTorch or NeMo dependency. فایل نسخهٔ فارسی: README_FA.md.
Why this version?
- Runtime is tiny:
sherpa-onnx >= 1.13.7+ numpy (~50 MB installed) instead of NeMo + PyTorch (~5 GB). - Streaming, cache-aware: real chunked streaming with a 1.12 s look-ahead (the most accurate of the 4 attention contexts the model was trained with).
- Weights are an unmodified conversion: encoder/decoder/joiner exported via the official
k2-fsa/sherpa-onnxscript; greedy decoding was verified token-for-token identical to the original checkpoint through sherpa-onnx. - Accuracy vs the other open Persian option (measured on a 143 s conversational clip — demo dictation video, 294 reference words, greedy decoding, one machine so treat as indicative):
| model | runtime | WER | RTF (4-thread old CPU) |
|---|---|---|---|
| Shenava Koochik 114M (Apache-2.0) | sherpa-onnx fp32 | 34.7% | 0.07 |
| this model, int8 | sherpa-onnx | 29.6% | 0.35 |
| this model, fp32 | sherpa-onnx | 27.9% | 0.39 |
| this model, fp32 | OpenVINO 2026.4 | 28.6% | 0.32 |
The i7-4702MQ (2013, no AVX-VNNI) is a worst-case CPU; on modern CPUs int8 typically gains another 2-3x. Koochik remains the right choice when raw CPU headroom matters more than accuracy.
Package contents
| file | size | what it is |
|---|---|---|
encoder.int8.onnx |
658 MB | cache-aware FastConformer encoder (24 layers, d=1024), dynamic int8 (QUInt8 weights) |
decoder.int8.onnx |
7.3 MB | RNN-T prediction network (2-layer LSTM, 640 hidden) |
joiner.int8.onnx |
1.7 MB | RNN-T joint |
tokens.txt |
16 KB | 1024 SentencePiece unigram pieces + <blk> |
The fp32 variant and other chunk sizes (80/160/320/560 ms) are not shipped here; they are one command away from the .nemo checkpoint with the export script referenced below.
Usage
import sherpa_onnx
rec = sherpa_onnx.OnlineRecognizer.from_transducer(
tokens="tokens.txt",
encoder="encoder.int8.onnx",
decoder="decoder.int8.onnx",
joiner="joiner.int8.onnx",
num_threads=4,
feature_dim=128, # this model uses 128 mel bins, not 80
)
stream = rec.create_stream()
stream.set_option("language", "fa-IR") # required: prompt-conditioned model
stream.accept_waveform(16000, samples)
stream.input_finished()
while rec.is_ready(stream):
rec.decode_stream(stream)
print(rec.get_result(stream))
CLI:
pip install -U "huggingface_hub[cli]"
hf download Nimaone/nemotron-asr-streaming-farsi-onnx --local-dir model
sherpa-onnx-online-decode \
--tokens=model/tokens.txt \
--encoder=model/encoder.int8.onnx \
--decoder=model/decoder.int8.onnx \
--joiner=model/joiner.int8.onnx \
--feature-dim=128 \
--language=fa-IR \
test.wav
Notes:
fa-IRis the only supported language (the fine-tune trained that prompt slot only).- Output is unpunctuated Persian with spelled-out numbers — apply your own ITN if you need digits.
- It is a transducer (not CTC): per-frame confidences are not exposed and CTC-based hotword boosting (e.g. pyctcdecode) does not apply.
What was done (conversion details)
- Downloaded the
.nemocheckpoint ofmehdi-hf/nemotron-asr-streaming-farsi(fine-tuned by mallahyari on 1,181 h of openly licensed Persian speech). - Exported encoder/decoder/joiner with the official sherpa-onnx script
scripts/nemo/nemotron-3.5-asr-streaming-0.6b/export_onnx.py(patched to restore the local.nemo),--chunk-size-ms 1120→ attention context[56, 13], window 121 / shift 112 mel frames. - Dynamic int8 quantization (
QUInt8weights) with onnxruntime. - Validated: word-for-word parity of streaming output against the NeMo/sherpa-onnx runtime, and benchmarked against Shenava Koochik (table above). Chunk 320 ms was slower on old CPUs; 2000 ms degrades accuracy (out-of-distribution attention context) — 1120 ms is the sweet spot.
License and credits
- ASR fine-tune: mehdi-hf/nemotron-asr-streaming-farsi by mallahyari — OpenMDW 1.1. This repo is a derivative (format conversion + int8 quantization) redistributed under the same license;
LICENSEandNOTICEare included unmodified. - Base architecture: nvidia/nemotron-3.5-asr-streaming-0.6b — NVIDIA.
- Export & quantization tooling: k2-fsa/sherpa-onnx (Apache-2.0), onnxruntime (MIT).
- Benchmark reference model: Reza2kn/Shenava-Koochik-v1.0 (Apache-2.0) by the Shenava-1 / VisualEars project.