需自行从 GitHub Releases 下载 kokoro-v1.0.onnx 和 voices-v1.0.bin 并放在同目录;ONNX Runtime 版本需 ≥1.20.1;v1.0 起推荐使用 misaki g2p 包。
pip install -U kokoro-onnx
uv add kokoro-onnx soundfileREADME 说明支持 CPU 与 GPU 运行,但未给出具体显存要求或 GPU 厂商型号;性能示例为 macOS M1 上接近实时。
基于 ONNX Runtime 的 Kokoro 语音合成库,轻量快速,支持多语言多音色
基于 Kokoro 模型和 ONNX Runtime 的轻量级语音合成方案,用 Python 就能在本地跑出高质量 TTS,省去复杂环境配置。
核心能力
- 用 ONNX Runtime 推理 Kokoro-TTS 模型
- 支持多语言与多种音色选择
- 量化模型仅约 80MB,轻量易部署
- macOS M1 上接近实时的合成速度
- 推荐搭配 misaki g2p 做文本转音素
容易踩的坑
- model-files-v1.1最新正式版2025-03-01 · 2025-03-01 14:13 UTC
Both Kokoro models in three precisions, exported with
scripts/export.py.file size notes kokoro-v1.0.onnx 326 MB English, full precision kokoro-v1.0.fp16.onnx 164 MB spectral correlation 0.999 against fp32 kokoro-v1.0.int8.onnx 114 MB spectral correlation 0.916 against fp32 kokoro-v1.1-zh.onnx 326 MB Chinese and English, full precision kokoro-v1.1-zh.fp16.onnx 164 MB spectral correlation 0.994 against fp32 kokoro-v1.1-zh.int8.onnx 114 MB spectral correlation 0.874 against fp32 voices-v1.0.bin 28 MB 54 voices for the v1.0 models voices-v1.1-zh.bin 53 MB 103 voices for the v1.1-zh models Every model in this release carries three improvements over the previous exports:
- a duration output, which kokoro-onnx 0.6.0 uses for
create_timed()timestamps and forcreate(continuous=True)sliding window synthesis - a float
speedinput. The previously published kokoro-v1.1-zh.onnx declared it as int32, so fractional speeds were truncated andspeed=0.9crashed the model (#155) - config.json embedded in the graph metadata, so the vocabulary travels with the model and no
vocab_configargument is needed
All variants keep float inputs and outputs and are called identically.
Note: kokoro-v1.1-zh.onnx replaces the file published in this release on Mar 1 2025. Same weights, fixed graph contract.
- a duration output, which kokoro-onnx 0.6.0 uses for
- model-files-v1.02025-01-28 · 2025-01-28 21:39 UTC
查看更新说明
kokoro-v1.0.onnx: (310MB): optimized f32 version from taylorchu/kokoro-onnxkokoro-v1.0.fp16.onnx: (169MB): optimized f16 version from taylorchu/kokoro-onnxkokoro-v1.0.int8.onnx: (88MB): optimized int8 version from taylorchu/kokoro-onnxvoices-v1.0.bin: npz (numpy) key value pairs of style vectors contains the following voices (26):See list of voice names and languages in https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md
- model-files2025-01-03 · 2025-01-03 16:32 UTC
查看更新说明
kokoro-v0_19.onnx: (310MB): optimized f32 version from taylorchu/kokoro-onnxkokoro-v0_19.fp16.onnx: (169MB): optimized f16 version from taylorchu/kokoro-onnxkokoro-v0_19.int8.onnx: (88MB): optimized int8 version from taylorchu/kokoro-onnxvoices.bin: npz (numpy) key value pairs of style vectors contains the following voices (26):af_alloy, af_aoede, af_bella, af_jessica, af_kore, af_nicole, af_nova, af_river, af_sarah, af_sky, am_adam, am_echo, am_eric, am_fenrir, am_liam, am_michael, am_onyx, am_puck, bf_alice, bf_emma, bf_isabella, bf_lily, bm_daniel, bm_fable, bm_george, bm_lewis
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
kokoro-onnx
TTS with onnx runtime based on Kokoro-TTS
🚀 Version 1.0 models are out now! 🎉
https://github.com/user-attachments/assets/00ca06e8-bbbd-4e08-bfb7-23c0acb10ef9
Features
- Supports multiple languages
- Fast performance near real-time on macOS M1
- Offer multiple voices
- Lightweight: ~300MB (quantized: ~80MB)
Setup
pip install -U kokoro-onnx
- Install uv for isolated Python (Recommend).
pip install uv
- Create new project folder (you name it)
- Run in the project folder
uv init -p 3.12
uv add kokoro-onnx soundfile
- Paste the contents of
examples/save.pyinhello.py - Download the files
kokoro-v1.0.onnx, andvoices-v1.0.binand place them in the same directory. - Run
uv run hello.py
You can edit the text in hello.py
That's it! audio.wav should be created.
Examples
See examples
Voices
See the latest voices and languages in Kokoro-82M/VOICES.md
Note: It's recommend to use misaki g2p package from v1.0, see examples
Contribute
See CONTRIBUTE.md
License
- kokoro-onnx: MIT
- kokoro model: Apache 2.0