File size: 2,983 Bytes
71f4dea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
language:
- fa
- en
license: gpl-3.0
library_name: tract
pipeline_tag: automatic-speech-recognition
tags: [persian, farsi, asr, zipformer, transducer, shenava, tract, rust, streaming]
base_model: Reza2kn/Shenava-Rizeh-v1.6
---

# Shenava Rizeh v1.6: tract streaming

A cache-aware streaming export of [Shenava Rizeh v1.6](https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.6) for the pure-Rust [tract](https://github.com/sonos/tract) engine. Each step consumes 320 ms of audio with 2.56 s of left context. `harness/main.rs` is a complete working example.

| File | Size | Streaming TT (held-out half, no LM, onnxruntime) | tract tokens = onnxruntime (4 clips) |
|---|---|---|---|
| `encoder.onnx` (fp32) | 228 MB | 5.24 | ✅ identical |
| `encoder.int4.onnx` (MatMulNBits, block 32) | 69 MB | 5.34 | ✅ identical |
| `encoder.int8.onnx` (MatMulInteger) | 60 MB | 5.25 | ✅ identical (slow in tract: dynamic activation quant) |

The decoder and joiner are fp32 and shared by every encoder.

**Speed:** the graph is identical to v1.5's. v1.5 measured about 24 ms (fp32) / 43 ms (int4) / 190 ms (int8) per 320 ms chunk, single thread, on a desktop x86. Use fp32 or int4.

## Streaming contract
- **Features:** 80-dim kaldi fbank (`fbank_torch.py`): samples in [-1, 1], povey window, `snip_edges=false`, 20–7600 Hz.
- **Steps:** feed `x` (1, 45, 80) each step and advance 32 frames. Append about 0.8 s of silence at the end of speech.
- **Encoder state:** `x` plus 92 caches (`reference/ref0.shapes` lists order, dtype and shape). Start every cache at zero, feed each `new_*` back, and **cast `new_processed_lens` to i64**.
- **RNN-T:**
  - `decoder` takes y i64 (1, 2), starting at [0, 0].
  - `joiner(encoder_out[t], decoder_out)` returns 2,080 logits.
  - Blank is 0. **Mask ids 32–1055** (the English block).

```bash
cargo run --release -- . reference/ref0 encoder.onnx   # harness/main.rs as src/main.rs; tract @ Reza2kn/tract 4259abe
python stream_ref.py . some.wav out/prefix            # onnxruntime reference for any wav
```

## All formats
- [Shenava-Rizeh-v1.6](https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.6): int4 `.tzf` for the tinyasr engine (CPU/WASM), KenLM, engine patch, training code
- [Shenava-Rizeh-v1.6-sherpa-onnx](https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.6-sherpa-onnx): offline + streaming, fp32 / int8 / int4
- [Shenava-Rizeh-v1.6-ONNX-fp16](https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.6-ONNX-fp16)
- [Shenava-Rizeh-v1.6-tract-streaming](https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.6-tract-streaming): pure Rust
- [Shenava-Rizeh-v1.6-CoreML-fp16](https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.6-CoreML-fp16) and [Shenava-Rizeh-v1.6-CoreML-iOS15-fp16](https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.6-CoreML-iOS15-fp16) (streaming)
- [Shenava-Rizeh-v1.6-Diarization](https://huggingface.co/Reza2kn/Shenava-Rizeh-v1.6-Diarization): who spoke when, 3.5M parameters on top of this encoder

## License
GPL-3.0, inherited from tinyasr.