A generative speech model for daily dialogue.
[!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.
You can refer to this video on Bilibili for the detailed description.
[!Important] The released model is for academic purposes only.
2noise org is welcomed)The code is published under AGPLv3+ license.
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.
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.
GitHub issues/PRs are always welcomed.
For formal inquiries about the model and roadmap, please contact us at [email protected].
Join by clicking here.
git clone https://github.com/2noise/ChatTTS
cd ChatTTSpip install --upgrade -r requirements.txtconda create -n chattts python=3.11
conda activate chattts
pip install -r requirements.txtpip install safetensors vllm==0.2.7 torchaudio[!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[!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-isolationMake sure you are under the project root directory when you execute these commands below.
python examples/web/webui.pyIt will save audio to
./output_audio_n.mp3
python examples/cmd/run.py "Your text 1." "Your text 2."pip install ChatTTSpip install git+https://github.com/2noise/ChatTTSpip install -e .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)……male speaker |
female speaker |
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.
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.
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.
tt.c
tt.c
Download
中文README.md中基础用法的代码有误
Python 3.12 + Cuda 12.6 Terminate without notice
vllm版似乎只能抽卡到男声音色,如果vllm怎么改变 成女生音色,大佬门帮忙看看
incomplete result. hit
low speaker similarity in zero-shot tts
可以问下笑声标签是通过什么模型得到的吗
使用vllm后的音色疑似只有男声