aystream's picture
Upload GigaAM-v4 e2e MLX weights (Zapformer, full-context + streaming)
d9bf696 verified
|
Raw History Blame Contribute Delete
2.85 kB
---
library_name: mlx
license: mit
language:
- ru
- en
tags:
- automatic-speech-recognition
- mlx
- apple-silicon
- russian
- english
- gigaam
- zapformer
- rnnt
- streaming
base_model: ai-sage/GigaAM-v4
pipeline_tag: automatic-speech-recognition
---
# GigaAM v4 e2e RNNT — MLX
Pure MLX port of [ai-sage/GigaAM-v4](https://huggingface.co/ai-sage/GigaAM-v4) (`revision="rnnt"`, e2e head) for 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("rnnt") # auto-downloads this repo
text = transcribe(model, tokenizer, "recording.wav")
print(text)
```
Or via CLI:
```bash
gigaam-mlx recording.mkv --model-type rnnt
```
### Real-time Streaming
```python
from gigaam_mlx import load_audio, load_model
model, tokenizer = load_model("rnnt")
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 RNNT (this)** | FP16 | **0.198s** | **~96x** |
| **MLX v4 RNNT (this)** | FP32 | **0.203s** | **~94x** |
| PyTorch CPU v4 RNNT | FP32 | 0.490s | ~39x |
- 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):** 25.7s (~51x realtime).
- **Streaming (320 ms context, dense chunk, FP32):** 17.3 ms/packet (~18x 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 <= 4e-6`).
## Model Details
- **Architecture:** Zapformer (Causal ConvNeXt frontend, 3 stages: `4×768d`, `11×1024d @2x`, `4×768d`, interleaved RoPE, RMSNorm) + RNN-Transducer head (LSTM predictor + joint)
- **Parameters:** ~236M (236,327,324, e2e head)
- **Vocabulary:** 1025 tokens (SentencePiece + 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