Automatic Speech Recognition
MLX
Russian
English
gigaam_mlx
apple-silicon
russian
english
gigaam
zapformer
ctc
streaming
Instructions to use aystream/GigaAM-v4-e2e-ctc-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use aystream/GigaAM-v4-e2e-ctc-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download aystream/GigaAM-v4-e2e-ctc-mlx --local-dir GigaAM-v4-e2e-ctc-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Upload GigaAM-v4 e2e MLX weights (Zapformer, full-context + streaming)
Browse files- README.md +87 -0
- config.json +190 -0
- weights.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: mlx
|
| 3 |
+
license: mit
|
| 4 |
+
language:
|
| 5 |
+
- ru
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- automatic-speech-recognition
|
| 9 |
+
- mlx
|
| 10 |
+
- apple-silicon
|
| 11 |
+
- russian
|
| 12 |
+
- english
|
| 13 |
+
- gigaam
|
| 14 |
+
- zapformer
|
| 15 |
+
- ctc
|
| 16 |
+
- streaming
|
| 17 |
+
base_model: ai-sage/GigaAM-v4
|
| 18 |
+
pipeline_tag: automatic-speech-recognition
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# GigaAM v4 e2e CTC — MLX
|
| 22 |
+
|
| 23 |
+
Pure MLX port of [ai-sage/GigaAM-v4](https://huggingface.co/ai-sage/GigaAM-v4) (`revision="ctc"`, e2e head) for fast Russian & English speech recognition on Apple Silicon. Supports **full-context** and **native streaming (`160 / 320 / 640 ms`)** without PyTorch.
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
pip install git+https://github.com/aystream/gigaam-mlx.git
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
### Offline / Full-context
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
from gigaam_mlx import load_model, transcribe
|
| 35 |
+
|
| 36 |
+
model, tokenizer = load_model("ctc") # auto-downloads this repo
|
| 37 |
+
text = transcribe(model, tokenizer, "recording.wav")
|
| 38 |
+
print(text)
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Or via CLI:
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
gigaam-mlx recording.mkv
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### Real-time Streaming
|
| 48 |
+
|
| 49 |
+
```python
|
| 50 |
+
from gigaam_mlx import load_audio, load_model
|
| 51 |
+
|
| 52 |
+
model, tokenizer = load_model("ctc")
|
| 53 |
+
stream = model.create_stream(tokenizer, future_context_ms=320)
|
| 54 |
+
|
| 55 |
+
audio = load_audio("recording.wav")
|
| 56 |
+
for i in range(0, len(audio), 3200):
|
| 57 |
+
print(stream.transcribe_partial(audio[i : i + 3200]), end="", flush=True)
|
| 58 |
+
print(stream.flush())
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Performance
|
| 62 |
+
|
| 63 |
+
MacBook Pro M2 Max, 19-second dense Russian speech chunk (295 chars, avg of 3 warmed-up runs):
|
| 64 |
+
|
| 65 |
+
| Backend | Precision | Time | Realtime |
|
| 66 |
+
|---|---|---|---|
|
| 67 |
+
| **MLX v4 CTC (this)** | FP16 | **0.038s** | **~507x** |
|
| 68 |
+
| **MLX v4 CTC (this)** | FP32 | **0.043s** | **~440x** |
|
| 69 |
+
| PyTorch CPU v4 CTC | FP32 | 0.417s | ~46x |
|
| 70 |
+
|
| 71 |
+
- MLX timings measure pure encode + decode (`librosa` mel extraction adds `~3.0 ms`); PyTorch timings include its `FeatureExtractor`.
|
| 72 |
+
- **Full 22-minute audio (1319.4s end-to-end):** 16.3s (~81x realtime).
|
| 73 |
+
- **Streaming (320 ms context, dense chunk, FP32):** 14.3 ms/packet (~22x realtime).
|
| 74 |
+
- **PyTorch parity:** Identical decoded text and streaming packet deltas vs `ai-sage/GigaAM-v4` PyTorch CPU reference across full-context and `160 / 320 / 640 ms` streaming modes on our test clips (`mean abs encoder diff <= 5e-6`).
|
| 75 |
+
|
| 76 |
+
## Model Details
|
| 77 |
+
|
| 78 |
+
- **Architecture:** Zapformer (Causal ConvNeXt frontend, 3 stages: `4×768d`, `11×1024d @2x`, `4×768d`, interleaved RoPE, RMSNorm) + character CTC head
|
| 79 |
+
- **Parameters:** ~235M (234,613,293, e2e head)
|
| 80 |
+
- **Vocabulary:** 146 classes (145 Russian/English/punctuation characters + blank)
|
| 81 |
+
- **Features:** Punctuation, normalization, Russian + English code-switching, full-context + streaming (`160/320/640 ms`)
|
| 82 |
+
|
| 83 |
+
## Links
|
| 84 |
+
|
| 85 |
+
- **Code:** [github.com/aystream/gigaam-mlx](https://github.com/aystream/gigaam-mlx)
|
| 86 |
+
- **Original:** [ai-sage/GigaAM-v4](https://huggingface.co/ai-sage/GigaAM-v4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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "gigaam_mlx",
|
| 3 |
+
"version": "v4",
|
| 4 |
+
"model_variant": "v4_e2e_ctc",
|
| 5 |
+
"architecture": "zapformer",
|
| 6 |
+
"framework": "mlx",
|
| 7 |
+
"source_repo": "ai-sage/GigaAM-v4",
|
| 8 |
+
"source_branch": "ctc",
|
| 9 |
+
"source_revision": "5b81216afa29c8b5a1a3e64c424c8416e18c1e5b",
|
| 10 |
+
"encoder": {
|
| 11 |
+
"in_channels": 64,
|
| 12 |
+
"frontend_channels": "16,32,64",
|
| 13 |
+
"downsampling_factor": "1,2,1",
|
| 14 |
+
"encoder_dim": "768,1024,768",
|
| 15 |
+
"num_encoder_layers": "4,11,4",
|
| 16 |
+
"num_heads": "12,16,12",
|
| 17 |
+
"query_head_dim": "32,32,32",
|
| 18 |
+
"value_head_dim": "32,32,32",
|
| 19 |
+
"feedforward_multiple": "4,4,4",
|
| 20 |
+
"conv_params": "5,0,5",
|
| 21 |
+
"activation": "SiLU",
|
| 22 |
+
"streaming_contexts_ms": [
|
| 23 |
+
160,
|
| 24 |
+
320,
|
| 25 |
+
640
|
| 26 |
+
],
|
| 27 |
+
"left_context": 32
|
| 28 |
+
},
|
| 29 |
+
"head": {
|
| 30 |
+
"type": "ctc",
|
| 31 |
+
"mode": "e2e",
|
| 32 |
+
"num_classes": 146
|
| 33 |
+
},
|
| 34 |
+
"preprocessor": {
|
| 35 |
+
"sample_rate": 16000,
|
| 36 |
+
"n_mels": 64,
|
| 37 |
+
"hop_length": 160,
|
| 38 |
+
"win_length": 320,
|
| 39 |
+
"n_fft": 320,
|
| 40 |
+
"center": false
|
| 41 |
+
},
|
| 42 |
+
"total_parameters": 234613293,
|
| 43 |
+
"vocabulary": [
|
| 44 |
+
" ",
|
| 45 |
+
"!",
|
| 46 |
+
"\"",
|
| 47 |
+
"%",
|
| 48 |
+
"&",
|
| 49 |
+
"'",
|
| 50 |
+
"+",
|
| 51 |
+
",",
|
| 52 |
+
"-",
|
| 53 |
+
".",
|
| 54 |
+
"/",
|
| 55 |
+
"0",
|
| 56 |
+
"1",
|
| 57 |
+
"2",
|
| 58 |
+
"3",
|
| 59 |
+
"4",
|
| 60 |
+
"5",
|
| 61 |
+
"6",
|
| 62 |
+
"7",
|
| 63 |
+
"8",
|
| 64 |
+
"9",
|
| 65 |
+
":",
|
| 66 |
+
";",
|
| 67 |
+
"?",
|
| 68 |
+
"A",
|
| 69 |
+
"B",
|
| 70 |
+
"C",
|
| 71 |
+
"D",
|
| 72 |
+
"E",
|
| 73 |
+
"F",
|
| 74 |
+
"G",
|
| 75 |
+
"H",
|
| 76 |
+
"I",
|
| 77 |
+
"J",
|
| 78 |
+
"K",
|
| 79 |
+
"L",
|
| 80 |
+
"M",
|
| 81 |
+
"N",
|
| 82 |
+
"O",
|
| 83 |
+
"P",
|
| 84 |
+
"Q",
|
| 85 |
+
"R",
|
| 86 |
+
"S",
|
| 87 |
+
"T",
|
| 88 |
+
"U",
|
| 89 |
+
"V",
|
| 90 |
+
"W",
|
| 91 |
+
"X",
|
| 92 |
+
"Y",
|
| 93 |
+
"Z",
|
| 94 |
+
"a",
|
| 95 |
+
"b",
|
| 96 |
+
"c",
|
| 97 |
+
"d",
|
| 98 |
+
"e",
|
| 99 |
+
"f",
|
| 100 |
+
"g",
|
| 101 |
+
"h",
|
| 102 |
+
"i",
|
| 103 |
+
"j",
|
| 104 |
+
"k",
|
| 105 |
+
"l",
|
| 106 |
+
"m",
|
| 107 |
+
"n",
|
| 108 |
+
"o",
|
| 109 |
+
"p",
|
| 110 |
+
"q",
|
| 111 |
+
"r",
|
| 112 |
+
"s",
|
| 113 |
+
"t",
|
| 114 |
+
"u",
|
| 115 |
+
"v",
|
| 116 |
+
"w",
|
| 117 |
+
"x",
|
| 118 |
+
"y",
|
| 119 |
+
"z",
|
| 120 |
+
"°",
|
| 121 |
+
"Ё",
|
| 122 |
+
"А",
|
| 123 |
+
"Б",
|
| 124 |
+
"В",
|
| 125 |
+
"Г",
|
| 126 |
+
"Д",
|
| 127 |
+
"Е",
|
| 128 |
+
"Ж",
|
| 129 |
+
"З",
|
| 130 |
+
"И",
|
| 131 |
+
"Й",
|
| 132 |
+
"К",
|
| 133 |
+
"Л",
|
| 134 |
+
"М",
|
| 135 |
+
"Н",
|
| 136 |
+
"О",
|
| 137 |
+
"П",
|
| 138 |
+
"Р",
|
| 139 |
+
"С",
|
| 140 |
+
"Т",
|
| 141 |
+
"У",
|
| 142 |
+
"Ф",
|
| 143 |
+
"Х",
|
| 144 |
+
"Ц",
|
| 145 |
+
"Ч",
|
| 146 |
+
"Ш",
|
| 147 |
+
"Щ",
|
| 148 |
+
"Ъ",
|
| 149 |
+
"Ы",
|
| 150 |
+
"Ь",
|
| 151 |
+
"Э",
|
| 152 |
+
"Ю",
|
| 153 |
+
"Я",
|
| 154 |
+
"а",
|
| 155 |
+
"б",
|
| 156 |
+
"в",
|
| 157 |
+
"г",
|
| 158 |
+
"д",
|
| 159 |
+
"е",
|
| 160 |
+
"ж",
|
| 161 |
+
"з",
|
| 162 |
+
"и",
|
| 163 |
+
"й",
|
| 164 |
+
"к",
|
| 165 |
+
"л",
|
| 166 |
+
"м",
|
| 167 |
+
"н",
|
| 168 |
+
"о",
|
| 169 |
+
"п",
|
| 170 |
+
"р",
|
| 171 |
+
"с",
|
| 172 |
+
"т",
|
| 173 |
+
"у",
|
| 174 |
+
"ф",
|
| 175 |
+
"х",
|
| 176 |
+
"ц",
|
| 177 |
+
"ч",
|
| 178 |
+
"ш",
|
| 179 |
+
"щ",
|
| 180 |
+
"ъ",
|
| 181 |
+
"ы",
|
| 182 |
+
"ь",
|
| 183 |
+
"э",
|
| 184 |
+
"ю",
|
| 185 |
+
"я",
|
| 186 |
+
"ё",
|
| 187 |
+
"—",
|
| 188 |
+
"№"
|
| 189 |
+
]
|
| 190 |
+
}
|
weights.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:132725c9c807fccc35ce1e62c7b4abfdd0648a25af841577cf9cf3e97b7768a0
|
| 3 |
+
size 469493750
|