gigastt-core
Core inference engine for gigastt — Russian (and optional multilingual) speech recognition powered by GigaAM v3 via ONNX Runtime. No server dependencies; no tokio runtime required for inference itself — embed it in any Rust application.
Runtime is INT8 only. Default rnnt / e2e_rnnt files come from GitHub Releases; ml_ctc / ml_ctc_large come from HuggingFace, as do the optional speaker-embedding and punctuation sidecars — the Silero VAD sidecar comes from GitHub (snakers4/silero-vad).
Usage
[]
= "2.20"
use Engine;
use model;
// Download the lean INT8 bundle on first run (~225 MB, GitHub Releases)
let model_dir = default_model_dir;
ensure_model.await?;
// Default pool size is 2 (1 on Android); use load_with_pool_size to override
let engine = load?;
// let engine = Engine::load_with_pool_size(&model_dir, 1)?;
let mut guard = engine.pool.checkout.await?;
let result = engine.transcribe_file?;
println!;
// guard is returned to the pool on drop
Streaming recognition
process_chunk takes 16 kHz mono f32 samples, not PCM16 bytes. Convert
or resample before the call (the server does that on the WebSocket path).
use Engine;
let engine = load?;
let mut guard = engine.pool.checkout.await?;
let mut state = engine.create_state;
// samples: &[f32], 16 kHz mono, any chunk length
let segments = engine.process_chunk?;
for seg in &segments
if let Some = engine.flush_state
Live WebSocket WER is not batch-equal — buffered offline RNN-T, not a native streaming AM. Numbers and protocol: docs/benchmarks.md.
Features
Defaults (diarization, net, async-pool, file-decode, quantize) make
the engine work out of the box. For a lean embedded build that side-loads
INT8 models and feeds raw PCM, disable defaults:
= { = "2.20", = false }
That drops tokio, reqwest/HTTP, symphonia, ryf, and the quantizer (protoc)
from the dependency graph. Opt features back in as needed.
| Feature | Default | Description |
|---|---|---|
net |
on | HTTP model download (reqwest + async fs); off → side-loaded models only |
async-pool |
on | async Pool::checkout; off → synchronous checkout_blocking only (no tokio runtime) |
file-decode |
on | file transcription via ryf (WAVE family: PCM/IEEE, G.711, G.722, ADPCM, RF64) + symphonia (MP3/M4A/OGG/FLAC/Opus, WebM/MKV); off → raw-PCM streaming only |
diarization |
on | speaker identification via polyvoice |
quantize |
on | packaging-only INT8 rebuild from a local FP32 ONNX (protoc required) |
ort-load-dynamic |
off | link a system/vendored onnxruntime instead of the build-time download |
coreml / cuda / nnapi |
off | ORT execution providers (coreml / cuda are mutually exclusive) |
ane / candle |
off | non-ORT backends (Apple Neural Engine .mlpackage / Candle+Metal) |
What's included
- Inference engine — ONNX Runtime session pool, Conformer encoder, RNN-T decoder + joiner (or greedy CTC on the multilingual heads)
- Mel spectrogram — 64 bins, FFT=320, hop=160, HTK scale
- Tokenizer — char vocab 34 (
rnnt), BPE 1025 (e2e_rnnt), multilingual char 71 (ml_ctc/ml_ctc_large) - Audio loading — WAVE family via
ryf(PCM/IEEE, G.711, G.722, MS/IMA ADPCM, RF64/RIFX/Wave64); M4A, MP3, OGG, FLAC, Opus, WebM/MKV via symphonia; resampling via rubato - Model download — streaming fetch with SHA-256 verification + atomic rename (Releases for default INT8; HuggingFace for CTC / sidecars)
- Protocol types —
ClientMessage,ServerMessage,TranscriptSegmentfor WebSocket/REST
Requirements
- Rust 1.94+ (edition 2024)
protocon PATH only when thequantizefeature is on (brew install protobuf/apt install protobuf-compiler)
License
MIT