GigaAM Multilingual v2 ONNX

ONNX builds of GigaAM Multilingual v2, 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 1.91 % (original 1.91 %), 400 of 400 transcripts identical (CUDA, RTF 0.020)
fp16 fp16/advance.onnx 23.0 MB a28f37c53e33 (the same build: numbers in its first row)
fp16 fp16/config.json 0.3 kB 43e39934c897 (the same build: numbers in its first row)
fp16 fp16/e2e_tokenizer.model 54.2 kB 3b049685e51a (the same build: numbers in its first row)
fp16 fp16/encoder.onnx 1.9 MB 0ef937c10c12 (the same build: numbers in its first row)
fp16 fp16/encoder.onnx.data 1.55 GB 0a7914adcf82 (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.8 kB 4689dec3dde7 (the same build: numbers in its first row)
fp16 fp16/raw_tokenizer.model 26.9 kB c51fe228b747 (the same build: numbers in its first row)
int4 int4/LICENSE 1.1 kB d02ed0afc408 encoder MatMuls 4-bit: WER 1.92 %, 303 of 400 identical, 0.75 % of words read differently (CUDA, RTF 0.021)
int4 int4/advance.onnx 23.0 MB a28f37c53e33 (the same build: numbers in its first row)
int4 int4/config.json 0.3 kB 43e39934c897 (the same build: numbers in its first row)
int4 int4/e2e_tokenizer.model 54.2 kB 3b049685e51a (the same build: numbers in its first row)
int4 int4/encoder.onnx 1.8 MB 123f2fe297fd (the same build: numbers in its first row)
int4 int4/encoder.onnx.data 494.5 MB 87e5e8e8e8d1 (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.8 kB 4689dec3dde7 (the same build: numbers in its first row)
int4 int4/raw_tokenizer.model 26.9 kB c51fe228b747 (the same build: numbers in its first row)

How to run

Sber's GigaAM Multilingual v2 (a 776M Zapformer RNN-T speech recogniser for 21 languages: Russian, English, Kazakh, Kyrgyz, Uzbek, Belarusian, French, Spanish, Bashkir, Georgian, Armenian, Romanian, Turkmen, Azerbaijani, Tajik, German, Italian, Dutch, Polish, Portuguese, Tatar; 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), language_vector [B, 32] (one-hot: slot 0 "auto", then the languages in config.json order) -> 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 3 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), the language vector, and the SentencePiece decode. It needs numpy, onnxruntime (or onnxruntime-gpu), sentencepiece and soundfile:

python fp16/pipeline.py speech.wav --language en --cuda
import sys; sys.path.insert(0, "int4")
import pipeline
asr = pipeline.GigaAM("int4", "cuda")                # or "cpu"
print(asr(audio, 16000, language="en"))              # "auto" detects; head="raw" for plain 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).

Precisions. fp16/: the encoder's weights stored in fp16, computed in fp32. int4/: the encoder's MatMul weights 4-bit (MatMulNBits, block 32; 238 of them), its other weights fp32. advance.onnx is fp32 (23 MB) in both. Both were converted one tensor at a time (lab/recipes/onnx/stream_quant.py: the in-memory tools need 12 GB for this encoder). No int8 (the int4 build already passes) or bf16 build.

Benchmark. 400 LibriSpeech test-clean utterances (the first 10 of 2-20 s from each of its 40 speakers, 0.9 h), English (language="en"), the e2e head. WER with Whisper's English text normaliser. 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. Real-time factor (processing time / audio time, lower is faster) on an RTX 3080 Laptop GPU, whole pipeline.

Clips WER Same transcript as the original Read differently Real-time factor
original (PyTorch fp32, CUDA) 400 1.91 % - - 0.041
ONNX fp32 (CUDA, not published) first 100 1.74 % (original 1.74 %) 100 0.00 % 0.020
fp16/ (CUDA) 400 1.91 % 400 0.00 % 0.020
int4/ (CUDA) 400 1.92 % 303 0.75 % 0.021

License. MIT, as the original.

How these were made

From GigaAM Multilingual v2 at revision c9d7aee4af. 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 Multilingual v2

GigaAM Multilingual-v2 brings speech recognition to 21 languages. The model was pretrained on 10 million hours of unlabelled audio and trained on 155,000 hours of supervised speech. Model uses two RNN-T heads for raw (unformatted) and e2e (formatted) transcripts. Both full-context and streaming (160ms, 320ms, 640ms) ASR are supported.

Versions

  • ssl: base foundation model.
  • rnnt: RNN-T dual-head ASR with optional language conditioning. The main branch points to this revision.

The RNNT revision includes paired SentencePiece tokenizers.

Multilingual WER (%)

Lower is better. GigaAM uses auto language mode in full-context and 640 ms streaming inference.

Language GigaAM (776M) GigaAM (776M, 640 ms) Omni LLM (7B) Whisper large-v3 (1.55B) Qwen3-ASR (1.7B) Rumble-2-Flash (0.5B) Parakeet Ultra (0.6B)
Average 3.96 5.58 14.10 44.09 59.80 52.77 55.64
Russian 2.30 3.38 6.75 4.81 6.05 8.12 4.83
English 5.42 7.48 7.86 11.04 4.55 6.23 5.62
German 3.16 4.54 4.92 4.42 4.16 5.49 3.93
Spanish 3.06 3.80 3.73 3.55 3.49 3.91 3.21
French 5.36 7.11 7.13 7.80 6.04 7.97 5.70
Italian 2.28 3.13 3.38 3.68 3.54 3.80 2.65
Dutch 2.72 4.23 4.63 4.54 5.64 5.00 4.69
Polish 3.40 5.25 6.04 5.51 12.92 6.56 3.69
Portuguese 4.32 5.75 6.09 5.24 5.49 5.43 5.75
Romanian 4.90 7.28 17.20 16.73 45.62 12.25 14.76
Azerbaijani 5.31 8.14 24.85 26.58 80.15 17.64 100.51
Bashkir 2.74 4.58 12.83 96.49 107.49 108.88 101.80
Belarusian 2.50 3.71 7.25 74.02 85.09 15.58 81.70
Armenian 3.06 3.96 7.97 47.86 114.44 122.29 105.97
Georgian 4.52 6.04 10.34 68.64 127.93 136.58 113.51
Kyrgyz 4.32 5.71 17.51 87.32 107.44 107.04 103.25
Kazakh 3.95 5.75 14.20 35.82 105.95 107.72 101.27
Tajik 4.98 6.05 29.82 111.82 106.55 106.69 102.65
Turkmen 6.85 10.18 30.97 108.65 108.65 106.96 101.98
Tatar 4.31 6.08 50.72 96.66 106.94 107.15 103.49
Uzbek 3.70 5.08 21.82 104.79 107.61 106.88 97.57

Usage

Load the RNN-T revision with Transformers and call transcribe. Pass a supported language tag to select the language. The auto mode is also available.

from transformers import AutoModel

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

Use 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. The model uses the auto language setting from the loader unless you select another language.

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-Multilingual-v2-ONNX

Quantized
(19)
this model