Trà Đá TTS 10M (trada-tts-10m)
Trà Đá is a small Vietnamese text-to-speech model: 9.8M parameters, 24 kHz output, about 16× faster than real time on 4 CPU threads, or about 30× in the 2-step fast mode. It supports zero-shot voice cloning from a 5–15 s recording, and runs in PyTorch, in ONNX Runtime (no PyTorch needed) and in the browser with WebGPU, so text and voice never leave the device.
Trà Đá là mô hình đọc tiếng Việt 9,8 triệu tham số, hỗ trợ nhân bản giọng từ 5–15 giây ghi âm. Chạy được bằng PyTorch, ONNX Runtime, hoặc ngay trong trình duyệt bằng WebGPU. Có 4 giọng mẫu tổng hợp và nhân bản giọng từ 5–15 giây ghi âm.
Author: tsdocode
| Parameters | 9.80M (8.26M text→latent + 1.54M latent→waveform decoder) |
| Output | 24 kHz mono |
| Input | Vietnamese text: numbers, dates, units and currency are normalised automatically |
| Voices | 9 synthetic voices (4 presets + 5 TikTok-style) + zero-shot cloning from a 5–15 s reference |
| Runtimes | PyTorch · ONNX Runtime (CPU/GPU) · ONNX Runtime Web (WebGPU, WASM fallback) |
| Training data | viVoice (CC BY-NC-SA 4.0) + 61 h of YodaLingua-Vietnamese (CC BY 4.0), transcripts re-labelled with ChunkFormer |
| Fast mode | 2-step flow distilled with IntMeanFlow (fast=True), about 8× fewer flow compute than 16 steps |
| License | weights CC BY-NC-SA 4.0 (non-commercial); code Apache-2.0 |
Samples
| Voice | Text | Audio |
|---|---|---|
| Trà Đá · Nữ | Xin chào, mình là Trà Đá, một mô hình đọc tiếng Việt nhỏ gọn… | samples/tra-da-nu_chao-hoi.wav |
| Trà Đá · Nam | Sáng nay, ngày 20-11, nhiệt độ ở Hà Nội xuống còn 18 độ C… | samples/tra-da-nam_ban-tin.wav |
| Trà Đá · Nữ ấm | Dạ, em chào anh. Em gọi từ bộ phận chăm sóc khách hàng… | samples/tra-da-nu-am_tong-dai.wav |
| Trà Đá · Nam trầm | Chiều hôm ấy, mưa rơi lất phất trên con phố nhỏ… | samples/tra-da-nam-tram_ke-chuyen.wav |
Quick start
git clone https://huggingface.co/tsdocode/trada-tts && cd trada-tts
pip install -r requirements.txt # ONNX backend; add torch + safetensors for the PyTorch backend
python -m trada_tts "Xin chào, mình là Trà Đá." -o hello.wav --voice tra-da-nu
Python
from trada_tts import TradaTTSOnnx, TradaTTS
tts = TradaTTSOnnx.from_pretrained(".") # ONNX Runtime, CPU. Or TradaTTS.from_pretrained(".", device="cuda")
audio = tts.synthesize("Giá vàng hôm nay tăng 1,5%, lên 85.000.000 đồng một lượng.", voice="tra-da-nam")
tts.save(audio, "out.wav") # 24 kHz
audio = tts.synthesize("Đây là giọng của tôi.", voice="my_voice.wav") # zero-shot clone from 5-15 s of audio
synthesize(text, voice, cfg_weight=3.0, steps=16, speed=1.0, seed=0, min_syllable_ms=160, fast=False):
voice: a voice id (tra-da-nu,tra-da-nu-am,tra-da-nam,tra-da-nam-tram,review-phim-nam,ke-chuyen-nam,ban-tin-nu,game-nam,ban-hang-nu), a path to a reference recording, or a 192-d speaker embedding.cfg_weight: text guidance. Higher is clearer; lower is looser and more natural, but makes more mistakes.steps: flow-matching steps. 8 is faster and slightly rougher.fast=True: use the 2-step distilled flow (trada-tts-10m-2step.safetensors,onnx/cfm2.onnx). Text guidance is built in, socfg_weightis ignored. Quality is close to 16 steps (see Evaluation). The web demo always uses it.- Long text is split into sentences automatically.
min_syllable_ms(default 160): every syllable lasts at least this long. Without it the model sometimes rushes long numbers until syllables get swallowed. On number-heavy text, word errors drop from 10.0% to 6.0%, while ordinary text stays the same and only 2% slower. Set it to 0 to disable.
Phrasing: write it in the text. _ between two words reads them joined (no pause), , gives a short break and . a long one, e.g. "trước 17_giờ 30". The same choice is available per word index:
# word indices: 0 anh, 1 vui, 2 lòng, 3 thanh, ... 7 bảy, 8 giờ
y = tts.synthesize_chunk("anh vui lòng thanh toán trước mười bảy giờ ba mươi.", tts.voices["tra-da-nu"],
breaks={8: "join", 3: ","}) # no pause before "giờ"; short pause before "thanh"
"join"removes the pause by shortening the next word back to a typical length. It only ever shortens, which keeps the model in range.","and"."insert a short or long break.
In the web demo, click a word in the result and pick Tự động / _ Liền / , Ngắt ngắn / . Ngắt dài. The mark is written into the text box, which highlights _ and punctuation. A boundary inside a number (e.g. between "năm" and "mươi" of 2.350.000) first writes the number out in words.
In the browser (WebGPU)
python web/serve.py 8000 # then open http://localhost:8000/web/ in Chrome / Edge 113+
The page runs everything client-side: text normalisation, the model, iSTFT (a WGSL compute shader) and voice cloning. With WebGPU it runs the fast model on the hand-written int8 WGSL engine (int8/trada-int8.bin); otherwise it uses multi-threaded WASM with the int8 ONNX graphs. serve.py only adds the COOP/COEP headers that multi-threaded WASM needs; any static host that sends those headers works.
How it works
text → number fixes → Vietnamese normaliser (misaki ViCleaner) → letters + tone stream
→ ConvNeXt text encoder → duration per letter → frame-level condition
→ conditional flow matching, 16 Euler steps, text CFG → 32-d latent @ 25 Hz
→ Vocos-style decoder → magnitude/phase @ 50 Hz → iSTFT → 24 kHz
- Text: each syllable is spelled as its letters, with tone marks removed. The tone (ngang, huyền, sắc, hỏi, ngã, nặng) goes in a parallel stream with a word-start flag, so the model never has to learn tone-marked letters separately. There is no phonemiser.
- Speaker: a raw (un-normalised) 192-d CAM++ embedding conditions the encoder, the durations and the flow decoder.
ONNX graphs (onnx/):
| File | Size | I/O |
|---|---|---|
enc.onnx |
10 MB | ids, tones [1,N] int64, spk [1,192] → h [1,256,N], logdur [1,N] |
cfm.onnx |
23 MB | x [1,32,T], cond [1,256,T], t [1], spk [1,192], w [1] → v [1,32,T] (CFG baked in, one batch-2 pass) |
dec.onnx |
6 MB | z [1,32,T] → mag, phase [1,961,2T]; iSTFT n_fft 1920, hop 480, Hann, center=True |
cfm2.onnx |
24 MB | x [1,32,T], cond [1,256,T], t [1], r [1], spk [1,192] → average velocity over [t, r] (2-step fast model) |
enc/cfm2/dec.int8.onnx |
3 + 7 + 3 MB | the fast model with dynamic int8 quantization (onnxruntime); TradaTTSOnnx(..., int8=True) |
campplus.onnx |
28 MB | 80-bin Kaldi fbank [1,T,80] → speaker embedding [1,192]; only needed for cloning |
scripts/export_onnx.py rebuilds them from trada-tts-10m.safetensors; scripts/export_int8.py --onnx builds the int8 files.
WebGPU int8 engine (web/wgpu_engine.js, weights int8/trada-int8.bin, 10.7 MB): the fast model run with hand-written WGSL kernels instead of ONNX Runtime. Every Linear/Conv1d weight is int8 with one fp32 scale per output channel and is dequantized inside a tiled matmul kernel (W8A32); LayerNorm, GELU, the ConvNeXt residual, FiLM and the iSTFT-head exp are fused into the kernels. The web demo uses it whenever WebGPU is available, and the int8 ONNX graphs on WASM otherwise, so the first visit downloads about 11–13 MB instead of 40 MB.
Verification:
- ONNX vs PyTorch: max relative difference ≤ 2e-6 per graph.
- The JavaScript pipeline vs Python on identical noise: same tokens, waveform correlation 1.000000.
- WebGPU vs WASM in Chromium: correlation 1.00000.
- WGSL int8 engine vs PyTorch with the same int8 weights: relative difference ≤ 2e-6 per graph, waveform correlation 1.000000 end to end. Int8 vs fp32 on 48 sentences: syllable errors 3.7% vs 4.1%, DNSMOS 3.27 vs 3.25 (paired difference +0.02 ± 0.02).
Evaluation
| Result | |
|---|---|
| Syllable error rate, viVoice test (80 utterances, Whisper large-v3-turbo) | 17.0%; the viVoice-only release scored 16.6% in the same run (difference not significant, 95% CI −0.5 to +1.3 points). The real recordings score 18.1% under the same ASR, because the test set is noisy YouTube audio. |
| Syllable error rate, 4 preset voices × 48 sentences | 16 steps 4.8% · 2-step fast mode 5.1% · 16-step model run at 2 steps without distillation 5.3% |
| DNSMOS OVRL, same 48 sentences | 16 steps 3.28 (min 3.00) · fast mode 3.25 (min 2.90) |
| UTMOS (UTMOS22-strong), same 48 sentences | 16 steps 2.27 · fast mode 2.19 · fast mode int8 2.19. Real viVoice test recordings score 2.45. UTMOS was trained on English, so Vietnamese scores sit well below the English scale; compare against the real recordings, not against English TTS numbers. |
| Voice similarity, fast mode vs 16 steps | 0.973 (CAM++ cosine) |
| DNSMOS OVRL of the samples above | 3.22–3.45 |
| CPU speed, ONNX Runtime, 4 threads (server Xeon) | RTF 0.063 (16× real time); first sentence in 0.14 s (median) |
| Browser, WASM, 8 threads (headless Chromium on a shared server) | about 2× real time |
| Zero-shot cloning, unseen speakers | speaker similarity 0.71 and 0.63, against 0.89 and 0.86 for real clips of the same speakers (CAM++ cosine) |
WebGPU output was checked for correctness (it matches WASM), but its speed was not benchmarked on real GPU hardware. Expect it to be much faster than WASM on a discrete or Apple GPU.
Voices
All nine voices are synthetic. Each is the average speaker embedding of 6–63 viVoice channels of the same gender, so none belongs to a real person. The five "TikTok style" voices blend channels of one content genre: movie reviews, mystery storytelling, news, gaming and product sales. They get the genre's timbre without copying any one creator.
| id | Name | Group | Pitch | Blend of | Max similarity to any single channel |
|---|---|---|---|---|---|
tra-da-nu |
Trà Đá · Nữ | preset | 219 Hz | 63 channels | 0.46 |
tra-da-nu-am |
Trà Đá · Nữ ấm | preset | 207 Hz | 7 channels | 0.46 |
tra-da-nam |
Trà Đá · Nam | preset | 125 Hz | 55 channels | 0.57 |
tra-da-nam-tram |
Trà Đá · Nam trầm | preset | 100 Hz | 19 channels | 0.59 |
review-phim-nam |
Review phim · Nam | TikTok style | 115 Hz | 6 channels | 0.55 |
ke-chuyen-nam |
Kể chuyện · Nam trầm | TikTok style | 106 Hz | 7 channels | 0.67 |
ban-tin-nu |
Bản tin · Nữ | TikTok style | 223 Hz | 7 channels | 0.41 |
game-nam |
Game · Nam | TikTok style | 133 Hz | 6 channels | 0.55 |
ban-hang-nu |
Bán hàng · Nữ | TikTok style | 236 Hz | 6 channels | 0.50 |
For comparison, a real speaker's own clips score 0.73 against that speaker's average (median over channels).
Limitations
- Long text. The model was trained on 1–15 s utterances.
synthesizesplits long text at sentence and comma boundaries. - Normaliser. It covers common numbers, dates, units, currency and abbreviations. Foreign words and unusual acronyms may be read letter by letter or in Vietnamese spelling.
- Audio quality. It is limited by the small 32-d codec. It is clean but not studio quality.
- Cloning. It captures timbre and pitch, not accent or speaking style, and works best with clean single-speaker audio.
License and responsible use
- Weights (
trada-tts-10m.safetensors,trada-tts-10m-2step.safetensors,onnx/enc|cfm|cfm2|dec.onnx,voices/) are trained on viVoice (CC BY-NC-SA 4.0) and YodaLingua-Vietnamese (CC BY 4.0, as stated by its publisher), and are released under CC BY-NC-SA 4.0: non-commercial use, with attribution and share-alike. - Code is Apache-2.0.
- Third-party components are listed in
NOTICE: CAM++ (Apache-2.0), misaki (Apache-2.0) and ONNX Runtime Web (MIT).
Only clone a voice with the speaker's consent. Do not use this model to impersonate people, for fraud, or to make synthetic speech look like a real recording. Disclose that audio is synthetic when you publish it.
Citation
@misc{tradatts2026,
author = {tsdocode},
title = {Trà Đá TTS: a 10M-parameter on-device Vietnamese text-to-speech model},
year = {2026},
note = {https://huggingface.co/tsdocode/trada-tts}
}
- Downloads last month
- 71