QUAN-Transcribe-1.0 — ONNX / int8 / ORT-format build for Linux, Android and iOS
This is an unofficial conversion of qnguyen3/QUAN-Transcribe-1.0
(Vietnamese CTC speech recognition built on the EmbeddingGemma 2 audio encoder) to ONNX, with an 8-bit quantized
variant and an ONNX Runtime (.ort) file for mobile. It is not affiliated with or endorsed by the original author or Google.
Gemma Terms of Use apply — see License.
Files
| File | Size | Use |
|---|---|---|
quan_int8.onnx + quan_int8.onnx.data |
9.7 MB + 378 MB | int8 weights, ONNX. Keep both files in the same folder. Linux / desktop / mobile via ONNX Runtime |
quan_int8.ort (+ quan_int8.required_operators.config) |
368 MB | Same model in ONNX Runtime format (self-contained) for ONNX Runtime Mobile, optional reduced-size builds |
fp32/quan_fp32.onnx + .data |
10 MB + 1.4 GB | Full precision reference |
assets/ |
0.3 MB | vocab.json (unit → piece), mel window / filter bank / mel_config.json |
quan_onnx_infer.py |
Reference pipeline (numpy + onnxruntime) to port to Swift / Kotlin / C++ |
Real model size: the original repo's model.safetensors only holds about 100M parameters (the reader and the
fine-tuned top encoder layers); the frozen remainder of the encoder is downloaded from google/embeddinggemma-2.
The complete network is 356M parameters, which is what these files contain (1.4 GB in fp32, ~380 MB in int8).
Usage (Linux, any platform with onnxruntime)
pip install -r requirements.txt
python quan_onnx_infer.py audio.wav --model quan_int8.onnx
from quan_onnx_infer import Quan, load_audio
print(Quan("quan_int8.onnx", threads=4).transcribe(load_audio("audio.wav")))
Interface (for porting to mobile)
- Input
feats: float32[1, 1000, 128]— log-mel features of up to 10 s of 16 kHz mono audio, zero padded at the end. - Input
n_out: int64[1]— number of valid encoder frames,ceil(n_valid_mel_frames / 4). Frames after it are ignored by the reader. - Output
logits: float32[1, 250, 14919]. Use only the firstn_outframes. Greedy CTC: argmax, collapse repeats, drop unit 0 (blank). - Unit
i→assets/vocab.json["pieces"][i];▁is a space. Unit 1 (<unk>) never needs to be emitted. - Log-mel: pad 160 samples on the left, 320-sample frames with hop 160, multiply by
mel_window_320.f32, 512-point FFT magnitude, multiply by the[257, 128]filter bank (mel_filters_257x128.f32),log(x + 0.001).quan_onnx_infer.pyis the reference; it matches the original feature extractor to 4e-6. - Audio longer than 10 s: split it into windows of at most 10 s at a quiet spot and join the texts (see
split_windows). - Output text is lowercase without punctuation, and numbers are spelled out as words ("năm" rather than "5").
iOS / Android: use ONNX Runtime Mobile (onnxruntime-objc / onnxruntime-android) with quan_int8.ort.
The int8 model was only tested here with the ONNX Runtime CPU provider on Linux (aarch64); it has not been tested
on a phone, nor with NNAPI / CoreML execution providers.
Evaluation (measured in this conversion)
Google FLEURS Vietnamese test split, first 100 utterances only; punctuation removed and text lower-cased; WER in %. "No-digit" is the 84 utterances whose reference has no digits, because the model spells numbers as words while FLEURS uses digits. All variants use 10 s windows except the first row.
| Variant | WER (100 utt.) | WER (84 no-digit utt.) |
|---|---|---|
| Original PyTorch, 30 s windows (reference) | 10.45 | 6.80 |
| Original PyTorch, 10 s windows | 10.71 | 6.84 |
| ONNX fp32 | 10.68 | 6.84 |
| ONNX int8 | 10.91 | 7.23 |
Compared with the original repo's own greedy results on the full FLEURS test (6.75 reported by the author), this sample is small: treat differences below about 1 point as noise. Int8 costs about 0.4 point WER here.
Speed on a Cortex-X925 CPU (aarch64 Linux, ONNX Runtime 1.31, one 10 s window): int8 0.37 s with 1 thread, 0.15 s with 4 threads; fp32 1.41 s / 0.42 s. These are not phone numbers.
Limitations
- Vietnamese only. Fixed 10 s window, so short utterances cost as much as a full window.
- No n-gram language model (the original repo offers one that improves WER; not included).
- No streaming mode in this conversion.
- Numbers are written as words; punctuation and capitalization are not produced.
- Evaluated on a 100-utterance sample of clean read speech only.
Conversion
Exported from the original checkpoint with PyTorch's ONNX exporter (opset 18) after rewriting the encoder forward without hooks and replacing the
attention mask builder with an equivalent closed form (verified identical); weights of MatMul nodes were quantized to int8 with
ONNX Runtime dynamic quantization; the .ort file was produced with onnxruntime.tools.convert_onnx_models_to_ort
(runtime optimization style, ONNX Runtime 1.31).
License
These files are Model Derivatives of Gemma and are provided under the
Gemma Terms of Use (copy in GEMMA_TERMS_OF_USE.txt). Use is subject to the
Gemma Prohibited Use Policy (copy in GEMMA_PROHIBITED_USE_POLICY.txt),
which must be passed on to anyone you share these files with. See NOTICE for the modifications made. This is not legal advice.