aystream's picture
Upload GigaAM-v4 e2e MLX weights (Zapformer, full-context + streaming)
ab2ee71 verified
|
Raw History Blame Contribute Delete
2.83 kB
---
library_name: mlx
license: mit
language:
- ru
- en
tags:
- automatic-speech-recognition
- mlx
- apple-silicon
- russian
- english
- gigaam
- zapformer
- ctc
- streaming
base_model: ai-sage/GigaAM-v4
pipeline_tag: automatic-speech-recognition
---
# GigaAM v4 e2e CTC — MLX
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.
## Usage
```bash
pip install git+https://github.com/aystream/gigaam-mlx.git
```
### Offline / Full-context
```python
from gigaam_mlx import load_model, transcribe
model, tokenizer = load_model("ctc") # auto-downloads this repo
text = transcribe(model, tokenizer, "recording.wav")
print(text)
```
Or via CLI:
```bash
gigaam-mlx recording.mkv
```
### Real-time Streaming
```python
from gigaam_mlx import load_audio, load_model
model, tokenizer = load_model("ctc")
stream = model.create_stream(tokenizer, future_context_ms=320)
audio = load_audio("recording.wav")
for i in range(0, len(audio), 3200):
print(stream.transcribe_partial(audio[i : i + 3200]), end="", flush=True)
print(stream.flush())
```
## Performance
MacBook Pro M2 Max, 19-second dense Russian speech chunk (295 chars, avg of 3 warmed-up runs):
| Backend | Precision | Time | Realtime |
|---|---|---|---|
| **MLX v4 CTC (this)** | FP16 | **0.038s** | **~507x** |
| **MLX v4 CTC (this)** | FP32 | **0.043s** | **~440x** |
| PyTorch CPU v4 CTC | FP32 | 0.417s | ~46x |
- MLX timings measure pure encode + decode (`librosa` mel extraction adds `~3.0 ms`); PyTorch timings include its `FeatureExtractor`.
- **Full 22-minute audio (1319.4s end-to-end):** 16.3s (~81x realtime).
- **Streaming (320 ms context, dense chunk, FP32):** 14.3 ms/packet (~22x realtime).
- **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`).
## Model Details
- **Architecture:** Zapformer (Causal ConvNeXt frontend, 3 stages: `4×768d`, `11×1024d @2x`, `4×768d`, interleaved RoPE, RMSNorm) + character CTC head
- **Parameters:** ~235M (234,613,293, e2e head)
- **Vocabulary:** 146 classes (145 Russian/English/punctuation characters + blank)
- **Features:** Punctuation, normalization, Russian + English code-switching, full-context + streaming (`160/320/640 ms`)
## Links
- **Code:** [github.com/aystream/gigaam-mlx](https://github.com/aystream/gigaam-mlx)
- **Original:** [ai-sage/GigaAM-v4](https://huggingface.co/ai-sage/GigaAM-v4) / [salute-developers/GigaAM](https://github.com/salute-developers/GigaAM)
- **License:** MIT