GigaAM-v4 ONNX

ONNX builds of GigaAM-v4, made by Moonbox for on-device use with ONNX Runtime (CPU, CUDA, DirectML). Each precision is one folder holding the graphs and a small Python pipeline.py that does the rest (features, prompt, decoding loop); what the graphs take and return is under How to run.

Files

The last column is the benchmark on Moonbox's ONNX speech-recognition set (400 LibriSpeech test-clean utterances from all 40 speakers, plus 200 AISHELL-1 test utterances for models that speak Chinese; details under How to run): the word (or character) error rate, and how often the build reads a clip differently from the original PyTorch model.

Precision File Size sha256 Benchmark
fp16 fp16/LICENSE 1.1 kB d02ed0afc408 encoder fp16 storage / fp32 math: WER 2.19 % English, 3.84 % Russian (original 2.19 / 3.84 %), all 700 transcripts identical (CUDA, RTF 0.012; original 0.028)
fp16 fp16/advance.onnx 12.8 MB 82d73ee0ebc4 (the same build: numbers in its first row)
fp16 fp16/config.json 0.1 kB c963d0329f2f (the same build: numbers in its first row)
fp16 fp16/e2e_tokenizer.model 14.7 kB f547bcb38e07 (the same build: numbers in its first row)
fp16 fp16/encoder.onnx 477.3 MB b6c400122e3c (the same build: numbers in its first row)
fp16 fp16/mel_filters.npy 41.3 kB f4a5a69fa2be (the same build: numbers in its first row)
fp16 fp16/pipeline.py 4.2 kB bcd78f12d128 (the same build: numbers in its first row)
fp16 fp16/raw_tokenizer.model 15.4 kB dcbe2598d1b3 (the same build: numbers in its first row)
int4 int4/LICENSE 1.1 kB d02ed0afc408 encoder MatMuls 4-bit, convolutions int8: WER 2.31 % English, 4.36 % Russian; 464 of 700 identical, 0.88 / 1.56 % of words read differently (CUDA, RTF 0.012)
int4 int4/advance.onnx 12.8 MB 82d73ee0ebc4 (the same build: numbers in its first row)
int4 int4/config.json 0.1 kB c963d0329f2f (the same build: numbers in its first row)
int4 int4/e2e_tokenizer.model 14.7 kB f547bcb38e07 (the same build: numbers in its first row)
int4 int4/encoder.onnx 155.6 MB 0df3b07ef590 (the same build: numbers in its first row)
int4 int4/mel_filters.npy 41.3 kB f4a5a69fa2be (the same build: numbers in its first row)
int4 int4/pipeline.py 4.2 kB bcd78f12d128 (the same build: numbers in its first row)
int4 int4/raw_tokenizer.model 15.4 kB dcbe2598d1b3 (the same build: numbers in its first row)

How to run

Sber's GigaAM-v4 (a 238M Zapformer RNN-T speech recogniser for Russian and English, pretrained on 7 million hours; two output heads: "e2e", formatted text with punctuation and capitals, and "raw", plain lower-case text; 16 kHz mono input) as two ONNX graphs from the model's own full-context exporter (to_onnx in its modeling_gigaam.py) plus pipeline.py, a numpy runtime around them:

  • encoder.onnx: audio_signal [B, 64, T] (log-mel, 10 ms hop), length [B] (int64) -> encoded_len [B] and head_outputs [2, B, T / 4, 320] (each head's encoder projection; heads in config.json order, e2e first).
  • advance.onnx: the greedy RNN-T decode of both heads (at most 10 symbols per frame), as the exporter scripts it: projected [2, B, T', 320], lengths [B] -> tokens [steps, 2, B] (-1 where a row has ended).
  • e2e_tokenizer.model, raw_tokenizer.model: the heads' SentencePiece models.

pipeline.py computes the features (torchaudio's MelSpectrogram as the model's FeatureExtractor: 320-sample periodic Hann frames every 160 samples, not centred, 64 HTK mels, natural log clamped to [1e-9, 1e9]; 3e-4 from the original) and the SentencePiece decode. It needs numpy, onnxruntime (or onnxruntime-gpu), sentencepiece and soundfile:

python fp16/pipeline.py speech.wav --cuda
import sys; sys.path.insert(0, "int4")
import pipeline
asr = pipeline.GigaAM("int4", "cuda")                # or "cpu"
print(asr(audio, 16000))                             # head="raw" for plain lower-case text

The whole clip goes through the encoder in one call: split long recordings first (the original's transcribe_longform segments them with its own VAD model, which is not ported). The streaming variants of the encoder are not exported here.

Precisions. fp16/: the encoder's weights stored in fp16, computed in fp32 (0.5 GB). int4/: the encoder's MatMul weights 4-bit (MatMulNBits, block 32; 138 of them), its convolutions int8 (0.2 GB). advance.onnx is fp32 (13 MB) in both. No int8 (int4 already passes) or bf16 build.

Benchmark. English: 400 LibriSpeech test-clean utterances (the first 10 of 2-20 s from each of its 40 speakers, 0.9 h), WER with Whisper's English text normaliser. Russian: 300 FLEURS ru_ru test utterances (the first recording of each sentence of 2-20 s, 0.9 h), against FLEURS's raw transcription, WER after lower-casing, ั‘ -> ะต and dropping punctuation. The e2e head throughout. The original is the model's own transcribe (transformers 4.57, its remote code, fp32 on CUDA). "Read differently" is the WER of the build's transcripts against the original's own. Pass (the speech-recognition threshold used across these repositories): WER at most 1 point above the original's, per language. Real-time factor (processing time / audio time, lower is faster) on an RTX 3080 Laptop GPU, whole pipeline, over all 700 clips.

English WER same as the original read differently Russian WER same as the original read differently Real-time factor
original (PyTorch fp32, CUDA) 2.19 % - - 3.84 % - - 0.028
ONNX fp32 (CUDA, not published) 2.19 % 400 of 400 0.00 % 3.84 % 300 of 300 0.00 % 0.011
fp16/ (CUDA) 2.19 % 400 of 400 0.00 % 3.84 % 300 of 300 0.00 % 0.012
int4/ (CUDA) 2.31 % 254 of 400 0.88 % 4.36 % 210 of 300 1.56 % 0.012

License. MIT, as the original.

How these were made

From GigaAM-v4 at revision 180301a192. The graphs were exported from the original PyTorch modules with torch.onnx (opset 17) and checked against them; text decoders of audio-language models were built with onnxruntime-genai's model builder (inputs_embeds in, KV cache in and out). Weight-only quantization: int8 is a per-output-channel int8 weight behind DequantizeLinear (or 8-bit MatMulNBits in a text decoder), int4 is ONNX Runtime's MatMulNBits (block 32). Each card above says which precision every graph uses. Every precision was benchmarked against the original before upload (pass: error rate at most 1 point above the original's), and the sha256 column above is what the files must hash to.

License

MIT. These files are a derivative of the original model and carry its license: it is copied in this repository, and it governs your use of these files. The original model card follows unchanged.


Original model card

GigaAM-v4

GigaAM-v4 is a Zapformer-based speech foundation model pretrained on 7 million hours of unlabelled audio and trained on 58,000 hours of supervised speech. Model supports full-context and streaming (160ms, 320ms, 640ms), providing both raw and e2e transcripts with dual-head ASR and shared encoder.

Versions

  • ssl: base foundation model.
  • rnnt: RNN-T dual-head ASR. The main branch points to this revision.
  • ctc: CTC dual-head ASR.

The RNNT revision includes paired SentencePiece tokenizers.

Russian WER (%)

Lower is better. All models use full-context E2E outputs.

Test set or group GigaAM-v4 RNN-T GigaAM-v4 CTC GigaAM-v3 RNN-T GigaAM-v3 CTC Whisper large-v3 (auto) Nemotron 30B-A4B (auto) Parakeet Ultra Qwen3-ASR 1.7B (auto)
Params 238M 234M 222M 220M 1.5B 34B (4.3B active) 627M 2B
Open-source data
Golos Crowd 4.56 5.05 7.43 8.12 12.22 4.36 2.86 13.14
Golos Farfield 3.62 4.07 4.97 5.71 16.11 8.25 6.47 20.22
Russian LibriSpeech 3.69 4.06 5.77 5.93 8.61 9.16 9.19 15.16
Mozilla Common Voice 27 2.29 2.68 2.24 2.51 5.88 4.81 5.41 7.55
In-house data
Disordered Speech 12.88 12.78 18.68 16.55 33.69 35.45 32.13 44.29
Callcenter 6.71 7.20 11.04 11.92 25.96 26.70 20.77 23.95
Natural Speech 8.32 8.43 10.37 11.48 16.22 14.26 13.99 17.53
Synth IT Terms 5.07 5.61 15.27 15.23 9.63 14.63 12.57 15.31
Education 6.80 7.04 9.83 10.04 15.72 12.71 12.19 15.65
Average 5.99 6.33 9.51 9.72 16.01 14.48 12.84 19.20

English: Results on the public subset of the Open ASR benchmark

All full-context and streaming models are E2E. Nemotron is English-forced

Set GigaAM-v4 RNN-T GigaAM-v4 CTC Whisper large-v3 Qwen3-ASR Canary Flash 1B Parakeet TDT-CTC GigaAM-v4 RNN-T (640 ms) Nemotron 3.5 ASR (1120 ms)
Params 238M 234M 1.55B 938M 883M 1.1B 238M 600M
Average 7.28 7.83 7.70 6.67 7.96 7.85 8.49 9.51
AMI-Cleaned 7.47 11.34 13.66 9.47 11.76 12.19 8.47 12.19
Earnings22-Cleaned-AA-chunked 7.91 7.71 7.81 8.07 6.99 8.36 8.66 13.54
Gigaspeech-Cleaned 8.38 9.78 8.37 7.62 8.65 8.43 8.98 9.36
SPGISpeech 2.00 2.15 2.69 2.74 1.69 1.99 2.36 3.03
URGENT24 15.57 14.84 13.65 11.59 17.66 14.96 19.11 18.23
Voice Arena Monsoon 4.88 4.44 3.95 4.13 4.58 5.10 7.06 6.33
Voxpopuli-AA-Cleaned 4.79 4.55 3.79 3.06 4.42 3.95 4.81 3.94

Usage

Load an ASR revision with Transformers and call transcribe. The result contains unformatted raw text and formatted e2e text.

from transformers import AutoModel

model = AutoModel.from_pretrained(
    "ai-sage/GigaAM-v4", revision="rnnt", trust_remote_code=True,
    device="cuda", fp16_encoder=True,
).eval()
result = model.transcribe("example.wav")
print(result["raw"].text)
print(result["e2e"].text)

Use revision="ctc" for CTC ASR or revision="ssl" for the SSL model.

Streaming

Send audio chunks to the stateful stream to receive formatted text as it arrives. Calling flush() returns any remaining text.

stream = model.create_stream(future_context_ms=160)
audio_pieces = model.model.prepare_wav("example.wav")[0][0].split(32000)
for packet in audio_pieces:
    print(stream.transcribe_partial(packet)["e2e"].text, end="")
print(stream.flush()["e2e"].text, end="")

ONNX

Export the model as a full-context or streaming graph.

model.to_onnx("onnx_fc")
sessions, cfg = model.load_onnx("onnx_fc", model.model.cfg.model_name)
print(model.infer_onnx("example.wav", cfg, sessions)["e2e"][0])

prefix = model.to_onnx("onnx_stream", streaming=True)
sessions, cfg = model.load_onnx("onnx_stream", prefix)
stream = model.create_onnx_stream(cfg, sessions, future_context_ms=160)
for packet in audio_pieces:
    print(stream.transcribe_partial(packet)["e2e"].text, end="")
print(stream.flush()["e2e"].text, end="")

Dependencies

pip install numpy "transformers<5" onnx onnxruntime hydra-core omegaconf sentencepiece tqdm

For fine-tuning and more advanced usage, see the GigaAM GitHub repository.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for moonbox-dev/GigaAM-v4-ONNX

Quantized
(28)
this model