Download README.md from Reza2kn/Shenava-Rizeh-v1.5-tract-streaming: direct link, hf CLI and curl.
- Browser
- Download file 3.7 kB
-
https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.5-tract-streaming/resolve/main/README.md
- Command line
-
hf download hf://Reza2kn/Shenava-Rizeh-v1.5-tract-streaming/README.md
-
curl -L -o README.md https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.5-tract-streaming/resolve/main/README.md
language:
- fa
- en
license: gpl-3.0
library_name: onnx
pipeline_tag: automatic-speech-recognition
base_model:
- Reza2kn/Shenava-Rizeh-v1.5
base_model_relation: quantized
tags:
- automatic-speech-recognition
- persian
- farsi
- zipformer
- rnnt
- transducer
- streaming
- tract
- rust
- int4
- int8
- on-device
- shenava
ποΈ Shenava-Rizeh-v1.5-tract-streaming
A cache-aware streaming export of Shenava Rizeh v1.5 (a Zipformer2 RNN-T) that runs in the pure-Rust tract engine. Each step consumes 320 ms of audio and looks back up to 2.56 s.
Not a drop-in for v1.0. v1.0 was a single CTC graph. v1.5 is a transducer: an
encoderstep plus a smalldecoder/joinerloop.harness/main.rsis a complete working example.
Files and quality
All results are on the EVEN half of golden-6669 + FLEURS (2,758 clips), no LM, official TT. The timings are tract, single thread, on a loaded x86 desktop (Stallion), for one 320 ms chunk including the RNN-T loop.
| File | Size | Streaming TT (onnxruntime, beam 4) | tract ms / 320 ms chunk | tract tokens = onnxruntime |
|---|---|---|---|---|
encoder.onnx (fp32) |
228 MB | 5.31 | 24 (RTF 0.08) | β identical |
encoder.int4.onnx (MatMulNBits, block 32) |
69 MB | 5.22 | 43 | 1 token differs on the test clip |
encoder.int8.onnx (MatMulInteger) |
60 MB | 5.32 | 190 (dynamic activation quant is slow in tract) | β identical |
The decoder (5 MB) and joiner (4 MB) are fp32, and the same files are used with every encoder. For reference, the same model offline (whole utterance) scores 4.35, and with 640 ms chunks it scores 5.19 (re-export with chunk 32).
Recommendation: use fp32 if 228 MB is acceptable. Otherwise use int4, which is 3.3Γ smaller with the same accuracy, at about half the speed.
Streaming contract
- Features: 80-dim kaldi fbank (
fbank_torch.pyis a reference implementation; it matches kaldi-native-fbank). Use samples in [-1, 1], povey window,snip_edges=false, 20β7600 Hz. - Steps: each step feeds
x(1, 45, 80) and advances 32 frames (a 13-frame overlap). Append about 0.8 s of silence at the end of speech. - Encoder inputs:
xplus 92 caches.reference/ref5.shapeslists them in order with dtype and shape. Start every cache at zero. - Encoder outputs:
encoder_out(1, 8, 512) plus thenew_*caches, in the same order. Feed them back on the next step. Castnew_processed_lensback to i64: tract returns it as a symbolic TDim (see the harness). - RNN-T loop:
decodertakesyi64 (1, 2), the last two tokens, starting at[0, 0].joiner(encoder_out[t], decoder_out)returns logits over 2080 tokens.- Blank is 0. Mask ids 32β1055 (the English block) and take the argmax over 0β31 and 1056β2079.
- Output text: Persian digits and punctuation are already in the output; no ITN is needed.
Reproduce / verify
# Cargo deps: tract-onnx, tract-core (tested on tract @ Reza2kn/tract 4259abe, i.e. tract main + the NeMo streaming fixes)
cargo run --release -- . reference/ref5 encoder.onnx # harness/main.rs as src/main.rs
# -> chunks 53 ~24 ms/chunk tokens 57 match_ort true
python stream_ref.py . some.wav out/prefix # onnxruntime reference + chunk dump for any wav
export_onnx_streaming.py (with static) and make_tract_model.py regenerate every file here from shenava-rizeh-v1.5.tzf. The make_tract_model.py step runs onnxruntime's pure-ONNX BASIC optimizer, which folds the shape arithmetic that tract's type inference rejects.
License
GPL-3.0, inherited from tinyasr.