k2-fsa/OmniVoice
High-Quality Voice Cloning TTS for 600+ Languages
OmniVoice – 大规模、零样本文本转语音
是什么 – OmniVoice 是一个可合成 600 多种语言 的多语言文本转语音(TTS)系统,无需任何语言特定的微调。它采用扩散式语言模型架构,以极低的实时因子(RTF ≈ 0.025,即快 40 倍于实时)生成高质量音频。该模型支持三种主要用例:
- 语音克隆 – 生成与短参考录音相似的声音。
- 语音设计 – 不提供参考音频,而是指定说话人属性(性别、年龄、音高、口音、方言、轻声等)。
- 自动语音 – 让模型自动选择语音。
它还支持细粒度控制,例如非语言符号([laughter])和显式发音提示(中文拼音、英文 CMU 音素)。
快速开始
- Web UI – 运行
omnivoice-demo --ip 0.0.0.0 --port 8001启动 Gradio 演示。 - Hugging Face Space – 在 https://huggingface.co/spaces/k2-fsa/OmniVoice 在线试用模型。
- Colab 笔记本 – README 中链接了可直接运行的笔记本。
安装(pip)
# 安装与硬件匹配的 PyTorch(CUDA、Apple Silicon、Intel XPU)
# 例如,适用于最新 NVIDIA GPU:
pip install torch==2.8.0+cu128 torchaudio==2.8.0+cu128 \
--extra-index-url https://download.pytorch.org/whl/cu128
# 安装库(PyPI 上的稳定版)
pip install omnivoice
或者 从仓库直接安装(pip install git+https://github.com/k2-fsa/OmniVoice.git)或使用 uv 工具同步依赖。
Python API(核心模式)
from omnivoice import OmniVoice
import soundfile as sf, torch
model = OmniVoice.from_pretrained(
"k2-fsa/OmniVoice",
device_map="cuda:0", # Apple Silicon 用 "mps",Intel Arc 用 "xpu"
dtype=torch.float16)
# 1️⃣ 语音克隆
audio = model.generate(
text="Hello, this is a test of zero-shot voice cloning.",
ref_audio="ref.wav",
ref_text="Transcription of the reference audio.")
sf.write("out.wav", audio[0], 24000)
# 2️⃣ 语音设计
audio = model.generate(
text="Hello, this is a test of voice design.",
instruct="female, low pitch, british accent")
# 3️⃣ 自动语音
audio = model.generate(text="Just speak in a random voice.")
相同的 model.generate 调用还支持扩散步数(num_step)、速度因子、固定时长等众多参数,详见 docs/generation-parameters.md。
命令行工具
| 命令 | 典型用途 |
|---|---|
omnivoice-demo |
启动交互式 Gradio 演示 |
omnivoice-infer |
单句推理(语音克隆、设计或自动) |
omnivoice-infer-batch |
高吞吐批量推理,可跨 GPU 分布 |
所有 CLI 选项均与 Python API 参数一致(如 --ref_audio、--instruct、--num_step)。
速度优化技巧
- FlashInfer 内核可在不损失质量的情况下实现 2–2.9 倍加速。安装对应 CUDA 版本的预编译 wheel,并通过
--enable_flashinfer true(CLI)或apply_flashinfer(model)(Python)启用。CUDA 图进一步提升单批次(batch-size 1)的延迟性能。
训练与评估
仓库包含 examples/ 文件夹,逐步介绍数据准备、模型训练、评估和微调流程。用户可将该流程适配至自有数据。
社区与支持
- 问题在 GitHub 上处理。
- 提供微信群组和官方账号,用于中文社区讨论。
- 社区项目列表维护在
docs/community-projects.md中。
引用
若在研究中使用 OmniVoice,请引用 arXiv 论文:
@article{zhu2026omnivoice,
title={OmniVoice: Towards Omnilingual Zero‑Shot Text‑to‑Speech with Diffusion Language Models},
author={Zhu, Han and Ye, Lingxuan and Kang, Wei and Yao, Zengwei and Guo, Liyong and Kuang, Fangjun and Han, Zhifeng and Zhuang, Weiji and Lin, Long and Povey, Daniel},
journal={arXiv preprint arXiv:2604.00688},
year={2026}
}
伦理说明
作者明确禁止非法语音克隆、冒充、欺诈或其他任何非法/不道德用途。用户须遵守当地法规和负责任 AI 指南。
相关
- 项目
- 项目
- 项目
- 项目
- 项目