Cantonese-first ASR models from the WenetSpeech-Yue corpus, exported to ONNX for on-device, offline, CPU inference with sherpa-onnx.
No server, no Python, no PyTorch inside your app: ship the .onnx + tokens.txt
in your bundle (or download them on first launch) and run them on
Android / iOS / Windows / macOS / Linux / WebAssembly.
| Directory | Architecture | Params | fp32 | int8 | Recommended for |
|---|---|---|---|---|---|
sensevoice-small-yue/ |
SenseVoiceSmall, CTC | 234 M | 938 MB | 241 MB | default choice — best accuracy |
u2pp-conformer-yue/ |
WeNet U2++ Conformer, CTC | 138 M | 361 MB | 135 MB | size-constrained builds |
sensevoice-small-yue |
u2pp-conformer-yue |
|
|---|---|---|
| int8 size | 241 MB | 135 MB |
| Languages | yue / zh / en / ja / ko, selectable (language="yue") |
yue + zh (auto), no language switch |
| Text normalisation (ITN) | yes (use_itn=True) |
no (raw tokens) |
| Accuracy (WenetSpeech-Yue leaderboard) | better on every open-domain set | ~5–10 % relative CER worse on our clips |
| RTF (CPU, 4 threads) | ~0.012 | ~0.014 |
| Decoding | CTC greedy / CTC beam | CTC greedy / CTC beam (no attention rescoring) |
Both are non-streaming, CTC-only exports: the models' attention decoders are not part of the graph, so attention rescoring is not available in either.
| Model | Params | In-House Dialogue | yue | HK | MDCC | Daily_Use | Commands | WSYue Short | WSYue Long |
|---|---|---|---|---|---|---|---|---|---|
| Conformer-Yue (u2++) | 130 M | 16.57 | 7.72 | 11.42 | 5.73 | 5.73 | 8.97 | 5.05 | 8.89 |
| SenseVoice-s-Yue (this) | 234 M | 19.19 | 6.87 | 8.68 | 5.43 | 5.24 | 6.93 | 5.23 | 8.63 |
| Whisper-m-Yue | 769 M | 18.69 | 6.86 | 11.03 | 5.49 | 4.70 | 8.51 | 5.05 | 8.05 |
manifest.json # machine-readable index: paths, sizes, sha256, audio format
sensevoice-small-yue/
├── model.onnx 937,617,155 B fp32, opset 13
├── model.int8.onnx 241,161,214 B int8 dynamic (MatMul only, QUInt8)
├── tokens.txt 315,894 B 25,055 "<piece> <id>" lines
├── SHA256SUMS, export_meta.json
└── test_wavs/ 5 short Cantonese/Mandarin clips (16 kHz mono)
u2pp-conformer-yue/
├── model.onnx 360,832,061 B fp32, opset 13
├── model.int8.onnx 135,257,349 B int8 dynamic (MatMul only, QUInt8)
├── tokens.txt 85,361 B 8,629 "<piece> <id>" lines
├── SHA256SUMS, export_meta.json
Both formats carry the metadata sherpa-onnx needs to rebuild the frontend, so you do not implement fbank/LFR/CMVN yourself.
import sherpa_onnx
import soundfile as sf
rec = sherpa_onnx.OfflineRecognizer.from_sense_voice(
model="sensevoice-small-yue/model.int8.onnx",
tokens="sensevoice-small-yue/tokens.txt",
language="yue", # auto | zh | en | yue | ja | ko
use_itn=True,
num_threads=4,
)
samples, sr = sf.read("sensevoice-small-yue/test_wavs/yue_01_tong_bak_fu.wav", dtype="float32")
stream = rec.create_stream()
stream.accept_waveform(sr, samples) # 16 kHz mono required
rec.decode_stream(stream)
print(stream.result.text)
$ sherpa-onnx-offline \
--tokens=sensevoice-small-yue/tokens.txt \
--sense-voice-model=sensevoice-small-yue/model.int8.onnx \
--sense-voice-language=yue --sense-voice-use-itn=1 --num-threads=4 \
sensevoice-small-yue/test_wavs/yue_01_tong_bak_fu.wav
rec = sherpa_onnx.OfflineRecognizer.from_wenet_ctc(
model="u2pp-conformer-yue/model.int8.onnx",
tokens="u2pp-conformer-yue/tokens.txt",
num_threads=4,
)
# same create_stream / accept_waveform / decode_stream flow
$ sherpa-onnx-offline \
--tokens=u2pp-conformer-yue/tokens.txt \
--wenet-ctc-model=u2pp-conformer-yue/model.int8.onnx \
--num-threads=4 u2pp-conformer-yue/test_wavs/../../sensevoice-small-yue/test_wavs/yue_01_tong_bak_fu.wav
val config = OfflineRecognizerConfig(
modelConfig = OfflineModelConfig(
senseVoice = OfflineSenseVoiceModelConfig(
model = "$modelDir/model.int8.onnx",
language = "yue",
useInverseTextNormalization = true,
),
tokens = "$modelDir/tokens.txt",
numThreads = 4,
),
)
val recognizer = OfflineRecognizer(config) // sherpa-onnx Android AAR
For the U2++ model, set wenetCtc = OfflineWenetCtcModelConfig(model = ...)
instead of senseVoice.
Official sherpa-onnx bindings exist for Swift (SwiftPM sherpa-onnx), C/C++,
C#, Go, Java, Kotlin, JavaScript (Node + WebAssembly), Dart/Flutter, Rust and
HarmonyOS. Prebuilt platforms: Windows (x64/x86/arm64), macOS (x64/arm64),
Linux, Android (arm64-v8a/armeabi-v7a/x86/x86_64), iOS (arm64).
Fetch the int8 file only — that is the one meant for shipping.
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="jackuh02/WenetSpeech-Yue-ASR-ONNX",
filename="sensevoice-small-yue/model.int8.onnx",
revision="main", # pin a commit sha in production
)
Non-Python clients can use the plain CDN URL (HTTP Range / resumable, SHA-256 in
ETag / X-Linked-Etag):
https://huggingface.co/jackuh02/WenetSpeech-Yue-ASR-ONNX/resolve/main/sensevoice-small-yue/model.int8.onnx
Practical notes:
manifest.json lists every file with size + SHA-256 — fetch
it first, then download and verify.Range resume into filesDir.
iOS: URLSessionDownloadTask into Application Support.SHA256SUMS before loading; all three checksums were re-verified
after upload.All exports ran on CPU (Apple M-series, macOS, torch 2.9.1, opset 13), so the graphs contain no device-specific assumptions.
| Backend | max │Δlogit│ | frame argmax agreement | decoded text |
|---|---|---|---|
model.onnx (fp32) |
0.0023 | 100.00 % | identical |
model.int8.onnx |
6.98 | 99.63 % | 1 char per ~40 differs |
CER of int8 vs fp32 on the bundled clips: 0.00 / 1.89 / 3.45 / 0.75 / 0.00 % (mean ≈ 1.2 %). RTF: fp32 ≈ 0.025, int8 ≈ 0.012.
yue_02) decodes to an empty string by design: mean
p(blank) = 0.975. CTC models do this on non-speech; gate input with a VAD.一乡二理…). Apply OpenCC s2t
client-side if you need traditional (一鄉二理…).。,?.u2pp-conformer-yue/model.int8.onnx fails a strict onnx.checker run: the
ORT quantizer leaves a dead, non-topological If branch from the encoder's
streaming path. ONNX Runtime 1.23.2 and sherpa-onnx load and execute it
correctly (verified), and the fp32 graph passes the checker. Use fp32 if your
build pipeline validates graphs.# in the source repo: stt/openai-sensevoice-stt
# --- SenseVoice ---
.venv/bin/python scripts/export_sensevoice_onnx.py \
--src models/sensevoice_small_yue --out export/sensevoice-small-yue --remote-code ./model.py
PYTHONPATH=.export-deps .venv/bin/python scripts/validate_sensevoice_onnx.py \
--export-dir export/sensevoice-small-yue --language yue
# --- U2++ Conformer --- (needs a WeNet checkout: git clone --depth 1 ... /tmp/wenet)
PYTHONPATH=/tmp/wenet .venv/bin/python scripts/wenet/export_wenet_onnx.py
Deviations from the upstream k2-fsa exporters, both required:
dynamo=False — torch 2.9 defaults to the dynamo exporter, which breaks this graph.QuantType.QUInt8 instead of QInt8 — QInt8 MatMulInteger produces wrong
results in the C++ ONNX Runtime.tokens.txt comes from WeNet's lang_char.txt (8,629 ids), not
from bpe.model — that sentencepiece model is a 1,000-piece subword segmenter
used for text, not the CTC vocabulary.Sources: ASLP-lab/WSYue-ASR → sensevoice_small_yue/model.pt (234.0 M params)
and u2pp_conformer_yue/u2pp_conformer_yue.pt (138.2 M params, 659 keys).
@misc{wenetspeech_yue,
title = {WenetSpeech-Yue: A Large-scale Cantonese Speech Corpus with Multi-dimensional Annotation},
author = {ASLP-lab},
url = {https://github.com/ASLP-lab/WenetSpeech-Yue}
}
sensevoice-small-yue/model.onnx 938 MBu2pp-conformer-yue/model.onnx 361 MBsensevoice-small-yue/model.int8.onnx 241 MBu2pp-conformer-yue/model.int8.onnx 135 MBASLP-lab/WSYue-ASR