kokoro-onnx

thewh1teagleMIT活跃维护

基于 Kokoro 模型和 ONNX Runtime 的轻量级语音合成方案,用 Python 就能在本地跑出高质量 TTS,省去复杂环境配置。

TTS with kokoro and onnx runtime

model-files-v1.1发布于 2025-03-01 14:13 UTC2,860star315fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
pip install -U kokoro-onnx
uv add kokoro-onnx soundfile
硬件要求按 README 说明

README 说明支持 CPU 与 GPU 运行,但未给出具体显存要求或 GPU 厂商型号;性能示例为 macOS M1 上接近实时。

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 ONNX Runtime 的 Kokoro 语音合成库,轻量快速,支持多语言多音色

基于 Kokoro 模型和 ONNX Runtime 的轻量级语音合成方案,用 Python 就能在本地跑出高质量 TTS,省去复杂环境配置。

核心能力

  • 用 ONNX Runtime 推理 Kokoro-TTS 模型
  • 支持多语言与多种音色选择
  • 量化模型仅约 80MB,轻量易部署
  • macOS M1 上接近实时的合成速度
  • 推荐搭配 misaki g2p 做文本转音素

容易踩的坑

需自行从 GitHub Releases 下载 kokoro-v1.0.onnx 和 voices-v1.0.bin 并放在同目录;ONNX Runtime 版本需 ≥1.20.1;v1.0 起推荐使用 misaki g2p 包。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

3 个版本model-files-v1.1
  1. model-files-v1.1最新正式版2025-03-01 · 2025-03-01 14:13 UTC

    Both Kokoro models in three precisions, exported with scripts/export.py.

    filesizenotes
    kokoro-v1.0.onnx326 MBEnglish, full precision
    kokoro-v1.0.fp16.onnx164 MBspectral correlation 0.999 against fp32
    kokoro-v1.0.int8.onnx114 MBspectral correlation 0.916 against fp32
    kokoro-v1.1-zh.onnx326 MBChinese and English, full precision
    kokoro-v1.1-zh.fp16.onnx164 MBspectral correlation 0.994 against fp32
    kokoro-v1.1-zh.int8.onnx114 MBspectral correlation 0.874 against fp32
    voices-v1.0.bin28 MB54 voices for the v1.0 models
    voices-v1.1-zh.bin53 MB103 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 for create(continuous=True) sliding window synthesis
    • a float speed input. The previously published kokoro-v1.1-zh.onnx declared it as int32, so fractional speeds were truncated and speed=0.9 crashed the model (#155)
    • config.json embedded in the graph metadata, so the vocabulary travels with the model and no vocab_config argument 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.

  2. model-files-v1.02025-01-28 · 2025-01-28 21:39 UTC
    查看更新说明

    kokoro-v1.0.onnx: (310MB): optimized f32 version from taylorchu/kokoro-onnx kokoro-v1.0.fp16.onnx: (169MB): optimized f16 version from taylorchu/kokoro-onnx kokoro-v1.0.int8.onnx: (88MB): optimized int8 version from taylorchu/kokoro-onnx voices-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

  3. model-files2025-01-03 · 2025-01-03 16:32 UTC
    查看更新说明

    kokoro-v0_19.onnx: (310MB): optimized f32 version from taylorchu/kokoro-onnx kokoro-v0_19.fp16.onnx: (169MB): optimized f16 version from taylorchu/kokoro-onnx kokoro-v0_19.int8.onnx: (88MB): optimized int8 version from taylorchu/kokoro-onnx voices.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
    

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    kokoro-onnx

    Python Version PyPI Release Github Model Releases License GitHub stars PyPI Downloads

    ONNX Runtime CPU GPU

    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
    
    1. Install uv for isolated Python (Recommend).
    pip install uv
    
    1. Create new project folder (you name it)
    2. Run in the project folder
    uv init -p 3.12
    uv add kokoro-onnx soundfile
    
    1. Paste the contents of examples/save.py in hello.py
    2. Download the files kokoro-v1.0.onnx, and voices-v1.0.bin and place them in the same directory.
    3. 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