Downloads · 30 days
76
6% of all-time downloads
Bingsu/torchaudio_tacotron2_kss
torchaudio_tacotron2_kss is a text-to-speech model from Bingsu. Use it when you need text read aloud. It is set up for transformers. The card lists the license as other.
torchaudio Tacotron2 model, trained on kss dataset.
Downloads · 30 days
76
6% of all-time downloads
All-time downloads
1.3K
Public
Parameters
28.3M
244 MB on disk
Likes
3
Public
Click a slice to open those files.
.bin113 MB · 46%
From the Hugging Face model README
torchaudio Tacotron2 model, trained on kss dataset.
pytorch_model.bin weights: CC BY-NC-SA 4.0 (license of the kss dataset)pip install torch torchaudio transformers phonemizer
and you have to install espeak-ng
If you are using Windows, you need to set additional environment variables. see: https://github.com/bootphon/phonemizer/issues/44
import torch
from transformers import AutoModel, AutoTokenizer
repo = "Bingsu/torchaudio_tacotron2_kss"
model = AutoModel.from_pretrained(
repo,
trust_remote_code=True,
revision="589d6557e8b4bb347f49de74270541063ba9c2bc"
)
tokenizer = AutoTokenizer.from_pretrained(repo)
model.eval()
vocoder = torch.hub.load("seungwonpark/melgan:aca59909f6dd028ec808f987b154535a7ca3400c", "melgan", trust_repo=True, pretrained=False)
url = "https://huggingface.co/Bingsu/torchaudio_tacotron2_kss/resolve/main/melgan.pt"
state_dict = torch.hub.load_state_dict_from_url(url)
vocoder.load_state_dict(state_dict)
vocoder is same as original seungwonpark/melgan, but the weights are on the cuda, so I brought them separately.
text = "반갑습니다 타코트론2입니다."
inp = tokenizer(text, return_tensors="pt", return_length=True, return_attention_mask=False)
with torch.inference_mode():
out = model(**inp)
audio = vocoder(out[0])
import IPython.display as ipd
ipd.Audio(audio[0].numpy(), rate=22050)
<audio src="https://huggingface.co/Bingsu/torchaudio_tacotron2_kss/resolve/main/examples/sample1.wav" controls>