Downloads · 30 days
41
2% of all-time downloads
lunarlist/tts-thai
tts-thai is a text-to-speech model from lunarlist. Use it when you need text read aloud. It is set up for nemo. The card lists the license as mit.
This model is a Thai TTS model that use a voice from Common Voice dataset and modify the voice to not to sound like the original.
Downloads · 30 days
41
2% of all-time downloads
All-time downloads
2.1K
Public
Repo size
219 MB
Likes
4
Public
Click a slice to open those files.
.nemo219 MB · 100%
From the Hugging Face model README
This model is a Thai TTS model that use a voice from Common Voice dataset and modify the voice to not to sound like the original.
pip install nemo_toolkit['tts'] soundfile
from nemo.collections.tts.models import UnivNetModel
from nemo.collections.tts.models import Tacotron2Model
import torch
import soundfile as sf
model = Tacotron2Model.from_pretrained("lunarlist/tts-thai").to('cpu')
vcoder_model = UnivNetModel.from_pretrained(model_name="tts_en_libritts_univnet")
text='ภาษาไทย ง่าย นิด เดียว'
dict_idx={k:i for i,k in enumerate(model.hparams["cfg"]['labels'])}
parsed2=torch.Tensor([[66]+[dict_idx[i] for i in text if i]+[67]]).int().to("cpu")
spectrogram2 = model.generate_spectrogram(tokens=parsed2)
audio2 = vcoder_model.convert_spectrogram_to_audio(spec=spectrogram2)
# Save the audio to disk in a file called speech.wav
sf.write("speech.wav", audio2.to('cpu').detach().numpy()[0], 22050)