模型权重需从 HuggingFace 的 2Noise/ChatTTS 下载,首次运行会拉取;不要安装 TransformerEngine 和 FlashAttention-2,README 明确警告当前无法正常运行或会拖慢生成;模型为 CC BY-NC 4.0,仅限学术研究,不可商用。
pip install ChatTTS
python examples/web/webui.py30 秒音频至少需要 4GB 显存;在 4090 上 RTF 约 0.3。README 未说明 CPU 推理与 AMD 等非 NVIDIA 显卡的支持情况。
面向日常对话场景的开源语音生成模型,为 LLM 助手提供自然、带韵律的语音合成
开源的对话语音生成模型,能把文字转成自然流畅的日常对话语音,适合给聊天机器人和语音助手配音。
核心能力
- 针对对话场景优化,支持多说话人交互式合成
- 用 [laugh]、[uv_break]、[lbreak] 等 token 控制笑声、停顿与语气
- 支持中英文混合输入,英文仍属实验性
- 提供流式音频生成与零样本音色采样
- 可采样随机说话人并保存音色向量以便复现
容易踩的坑
- v0.2.5最新正式版2026-04-10 · 2026-04-10 16:33 UTC
Added
- Partial dml support (31ed623) by @fumiama
Fixed
- RuntimeError: narrow(): length must be non-negative (#955) by @fumiama
- Add missed dep requests in requirements.txt (cc212db) by @faalkor
- Keep tracking with latest transformers (857d3b7) by @fumiama
- v0.2.42025-05-23 · 2025-05-23 13:00 UTC
查看更新说明
Added
- FastAPI-based OpenAI-compatible Text-to-Speech API and Audio Format Conversion Tools to
examples/api(d582fd5) by @yueguobin - Numpy 2+ support (1092c1f) by @BBC-Esq
Fixed
- Module 'torch.serialization' has no attribute 'FILE_LIKE'' (8c0707b) by @aibaoku
新增
- 在
examples/api中添加了基于 FastAPI、兼容 OpenAI 的文本转语音 API 及音频格式转换工具 (d582fd5) by @yueguobin - 支持 Numpy 2+ (1092c1f) by @BBC-Esq
修复
- 'torch.serialization' 模块中无属性 'FILE_LIKE' 的问题 (8c0707b) by @aibaoku
- FastAPI-based OpenAI-compatible Text-to-Speech API and Audio Format Conversion Tools to
- v0.2.32025-02-18 · 2025-02-18 06:24 UTC
查看更新说明
Fixed
- Drop deprecated transformers API get_max_length() (a500911) by @fumiama
修复
- 停止使用废弃的 transformers API get_max_length() (a500911) by @fumiama
- v0.2.22025-01-25 · 2025-01-25 12:50 UTC
查看更新说明
New
- Support downloading HuggingFace models to custom path (#863) by @BBC-Esq
examples/apiallow not params refine text, and load normalizers to handle Chinese numbers (#865) by @JaysonAlbert- Support custom local download path (fefc931) by @fumiama
- Keep speaker in long-sentence infer (8d7bcf0) by @fumiama
Fixed
- Missing module name "tools.audio" (#880) by @benknam
Optimized
load_audioperformance (c3948c8) by @fumiama
新增
- 支持将 HuggingFace 模型下载到自定义路径 (#863) by @BBC-Esq
examples/api允许在不传入参数的情况下修正文本,并加载正则化器以处理中文数字 (#865) by @JaysonAlbert- 支持自定义本地下载路径 (fefc931) by @fumiama
- 在长句推理中保持同一音色 (8d7bcf0) by @fumiama
修复
- 缺少模块名 "tools.audio" (#880) by @benknam
优化
load_audio性能 (c3948c8) by @fumiama
- v0.2.12024-11-05 · 2024-11-05 05:14 UTC
查看更新说明
New
- NPU support (#777) by @shen-shanshan
Fixed
- No
remove_interjectionsin Chinese normalizer (#783) by @IrisSally
Optimized
- Change gamma to weight in DVAE for compatibility (#733) by @zly-idleness
- Migrate all models to safetensors (b9b007ef) by @fumiama
新增
- NPU 支持 (#777) by @shen-shanshan
修复
- 中文正则化器中缺少
remove_interjections(#783) by @IrisSally
优化
- 为了兼容性,将 DVAE 中的 gamma 改为 weight (#733) by @zly-idleness
- 将所有模型迁移到 safetensors (b9b007ef) by @fumiama
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
ChatTTS
A generative speech model for daily dialogue.
English | 简体中文 | 日本語 | Русский | Español | Français | 한국어
Introduction
[!Note] This repo contains the algorithm infrastructure and some simple examples.
[!Tip] For the extended end-user products, please refer to the index repo Awesome-ChatTTS maintained by the community.
You can find a diagram visualization of the codebase here.
ChatTTS is a text-to-speech model designed specifically for dialogue scenarios such as LLM assistant.
Supported Languages
- English
- Chinese
- Coming Soon...
Highlights
You can refer to this video on Bilibili for the detailed description.
- Conversational TTS: ChatTTS is optimized for dialogue-based tasks, enabling natural and expressive speech synthesis. It supports multiple speakers, facilitating interactive conversations.
- Fine-grained Control: The model could predict and control fine-grained prosodic features, including laughter, pauses, and interjections.
- Better Prosody: ChatTTS surpasses most of open-source TTS models in terms of prosody. We provide pretrained models to support further research and development.
Dataset & Model
[!Important] The released model is for academic purposes only.
- The main model is trained with Chinese and English audio data of 100,000+ hours.
- The open-source version on HuggingFace is a 40,000 hours pre-trained model without SFT.
Roadmap
- Open-source the 40k-hours-base model and spk_stats file.
- Streaming audio generation.
- Open-source DVAE encoder and zero shot inferring code.
- Multi-emotion controlling.
- ChatTTS.cpp (new repo in
2noiseorg is welcomed)
Licenses
The Code
The code is published under AGPLv3+ license.
The model
The model is published under CC BY-NC 4.0 license. It is intended for educational and research use, and should not be used for any commercial or illegal purposes. The authors do not guarantee the accuracy, completeness, or reliability of the information. The information and data used in this repo, are for academic and research purposes only. The data obtained from publicly available sources, and the authors do not claim any ownership or copyright over the data.
Disclaimer
ChatTTS is a powerful text-to-speech system. However, it is very important to utilize this technology responsibly and ethically. To limit the use of ChatTTS, we added a small amount of high-frequency noise during the training of the 40,000-hour model, and compressed the audio quality as much as possible using MP3 format, to prevent malicious actors from potentially using it for criminal purposes. At the same time, we have internally trained a detection model and plan to open-source it in the future.
Contact
GitHub issues/PRs are always welcomed.
Formal Inquiries
For formal inquiries about the model and roadmap, please contact us at [email protected].
Online Chat
1. QQ Group (Chinese Social APP)
- Group 1, 808364215
- Group 2, 230696694
- Group 3, 933639842
- Group 4, 608667975
2. Discord Server
Join by clicking here.
Get Started
Clone Repo
git clone https://github.com/2noise/ChatTTS
cd ChatTTS
Install requirements
1. Install Directly
pip install --upgrade -r requirements.txt
2. Install from conda
conda create -n chattts python=3.11
conda activate chattts
pip install -r requirements.txt
Optional: Install vLLM (Linux only)
pip install safetensors vllm==0.2.7 torchaudio
Unrecommended Optional: Install TransformerEngine if using NVIDIA GPU (Linux only)
[!Warning] DO NOT INSTALL! The adaptation of TransformerEngine is currently under development and CANNOT run properly now. Only install it on developing purpose. See more details on at #672 #676
[!Note] The installation process is very slow.
pip install git+https://github.com/NVIDIA/TransformerEngine.git@stable
Unrecommended Optional: Install FlashAttention-2 (mainly NVIDIA GPU)
[!Warning] DO NOT INSTALL! Currently the FlashAttention-2 will slow down the generating speed according to this issue. Only install it on developing purpose.
[!Note] See supported devices at the Hugging Face Doc.
pip install flash-attn --no-build-isolation
Quick Start
Make sure you are under the project root directory when you execute these commands below.
1. Launch WebUI
python examples/web/webui.py
2. Infer by Command Line
It will save audio to
./output_audio_n.mp3
python examples/cmd/run.py "Your text 1." "Your text 2."
Installation
- Install the stable version from PyPI
pip install ChatTTS
- Install the latest version from GitHub
pip install git+https://github.com/2noise/ChatTTS
- Install from local directory in dev mode
pip install -e .
Basic Usage
import ChatTTS
import torch
import torchaudio
chat = ChatTTS.Chat()
chat.load(compile=False) # Set to True for better performance
texts = ["PUT YOUR 1st TEXT HERE", "PUT YOUR 2nd TEXT HERE"]
wavs = chat.infer(texts)
for i in range(len(wavs)):
"""
In some versions of torchaudio, the first line works but in other versions, so does the second line.
"""
try:
torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]).unsqueeze(0), 24000)
except:
torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]), 24000)
Advanced Usage
###################################
# Sample a speaker from Gaussian.
rand_spk = chat.sample_random_speaker()
print(rand_spk) # save it for later timbre recovery
params_infer_code = ChatTTS.Chat.InferCodeParams(
spk_emb = rand_spk, # add sampled speaker
temperature = .3, # using custom temperature
top_P = 0.7, # top P decode
top_K = 20, # top K decode
)
###################################
# For sentence level manual control.
# use oral_(0-9), laugh_(0-2), break_(0-7)
# to generate special token in text to synthesize.
params_refine_text = ChatTTS.Chat.RefineTextParams(
prompt='[oral_2][laugh_0][break_6]',
)
wavs = chat.infer(
texts,
params_refine_text=params_refine_text,
params_infer_code=params_infer_code,
)
###################################
# For word level manual control.
text = 'What is [uv_break]your favorite english food?[laugh][lbreak]'
wavs = chat.infer(text, skip_refine_text=True, params_refine_text=params_refine_text, params_infer_code=params_infer_code)
"""
In some versions of torchaudio, the first line works but in other versions, so does the second line.
"""
try:
torchaudio.save("word_level_output.wav", torch.from_numpy(wavs[0]).unsqueeze(0), 24000)
except:
torchaudio.save("word_level_output.wav", torch.from_numpy(wavs[0]), 24000)
inputs_en = """
chat T T S is a text to speech model designed for dialogue applications.
[uv_break]it supports mixed language input [uv_break]and offers multi speaker
capabilities with precise control over prosodic elements like
[uv_break]laughter[uv_break][laugh], [uv_break]pauses, [uv_break]and intonation.
[uv_break]it delivers natural and expressive speech,[uv_break]so please
[uv_break] use the project responsibly at your own risk.[uv_break]
""".replace('\n', '') # English is still experimental.
params_refine_text = ChatTTS.Chat.RefineTextParams(
prompt='[oral_2][laugh_0][break_4]',
)
audio_array_en = chat.infer(inputs_en, params_refine_text=params_refine_text)
torchaudio.save("self_introduction_output.wav", torch.from_numpy(audio_array_en[0]), 24000)
male speaker
female speaker
FAQ
1. How much VRAM do I need? How about infer speed?
For a 30-second audio clip, at least 4GB of GPU memory is required. For the 4090 GPU, it can generate audio corresponding to approximately 7 semantic tokens per second. The Real-Time Factor (RTF) is around 0.3.
2. Model stability is not good enough, with issues such as multi speakers or poor audio quality.
This is a problem that typically occurs with autoregressive models (for bark and valle). It's generally difficult to avoid. One can try multiple samples to find a suitable result.
3. Besides laughter, can we control anything else? Can we control other emotions?
In the current released model, the only token-level control units are [laugh], [uv_break], and [lbreak]. In future versions, we may open-source models with additional emotional control capabilities.
Acknowledgements
- bark, XTTSv2 and valle demonstrate a remarkable TTS result by an autoregressive-style system.
- fish-speech reveals capability of GVQ as audio tokenizer for LLM modeling.
- vocos which is used as a pretrained vocoder.
Special Appreciation
- wlu-audio lab for early algorithm experiments.