Wednesday, June 5, 2024

ChatTTS Text to Speech Model Installation Locally

 This video shows a step-by-step process to locally install ChatTTS which is a text-to-speech model designed specifically for dialogue scenario such as LLM assistant. It supports both English and Chinese languages.



Code:

conda create -n chattts python=3.11 -y

git clone https://github.com/2noise/ChatTTS.git

cd ChatTTS

pip install -r requirements.txt
pip install gradio
pip install pynini
pip install nemo_text_processing
pip install WeTextProcessing
pip install torchaudio


import torch
torch._dynamo.config.cache_size_limit = 64
torch._dynamo.config.suppress_errors = True
torch.set_float32_matmul_precision('high')
import torchaudio
import ChatTTS
from IPython.display import Audio
import warnings
warnings.filterwarnings('ignore')

texts = ["hello, this is Fahd , and AI Youtuber. hahahaha. Subscribe to the channel please and also share it among your network",]

chat = ChatTTS.Chat()
chat.load_models()
       
wavs = chat.infer(texts)

torchaudio.save("/home/Ubuntu/audiooutput/myaudio1.wav", torch.from_numpy(wavs[0]), 24000)

No comments: