(function(){var el = document.createElement("script");el.src = "https://lf1-cdn-tos.bytegoofy.com/goofy/ttzz/push.js?0fd7cab5264a0de33b798f00c6b460fb0c1e12a69e1478bfe42a3cdd45db451bbc434964556b7d7129e9b750ed197d397efd7b0c6c715c1701396e1af40cec962b8d7c8c6655c9b00211740aa8a98e2e";el.id = "ttzz";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(el, s);})(window)

speechbrain/tts-tacotron2-ljspeech

古风汉服美女图集


Text-to-Speech (TTS) with Tacotron2 trained on LJSpeech

This repository provides all the necessary tools for Text-to-Speech (TTS) with SpeechBrain using a Tacotron2 pretrained on LJSpeech.
The pre-trained model takes in input a short text and produces a spectrogram in output. One can get the final waveform by applying a vocoder (e.g., HiFIGAN) on top of the generated spectrogram.


Install SpeechBrain

pip install speechbrain

Please notice that we encourage you to read our tutorials and learn more about
SpeechBrain.


Perform Text-to-Speech (TTS)

import torchaudio
from speechbrain.pretrained import Tacotron2
from speechbrain.pretrained import HIFIGAN
# Intialize TTS (tacotron2) and Vocoder (HiFIGAN)
tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech", savedir="tmpdir_tts")
hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-ljspeech", savedir="tmpdir_vocoder")
# Running the TTS
mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")
# Running Vocoder (spectrogram-to-waveform)
waveforms = hifi_gan.decode_batch(mel_output)
# Save the waverform
torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 22050)

If you want to generate multiple sentences in one-shot, you can do in this way:
from speechbrain.pretrained import Tacotron2
tacotron2 = Tacotron2.from_hparams(source="speechbrain/TTS_Tacotron2", savedir="tmpdir")
items = [
"A quick brown fox jumped over the lazy dog",
"How much wood would a woodchuck chuck?",
"Never odd or even"
]
mel_outputs, mel_lengths, alignments = tacotron2.encode_batch(items)


Inference on GPU

To perform inference on the GPU, add run_opts={"device":"cuda"} when calling the from_hparams method.


Training

The model was trained with SpeechBrain.
To train it from scratch follow these steps:

  1. Clone SpeechBrain:

git clone https://github.com/speechbrain/speechbrain/

  1. Install it:

cd speechbrain
pip install -r requirements.txt
pip install -e .

  1. Run Training:

cd recipes/LJSpeech/TTS/tacotron2/
python train.py --device=cuda:0 --max_grad_norm=1.0 --data_folder=/your_folder/LJSpeech-1.1 hparams/train.yaml

You can find our training results (models, logs, etc) here.


Limitations

The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.


About SpeechBrain

  • Website: https://speechbrain.github.io/
  • Code: https://github.com/speechbrain/speechbrain/
  • HuggingFace: https://huggingface.co/speechbrain/


Citing SpeechBrain

Please, cite SpeechBrain if you use it for your research or business.
@misc{speechbrain,
title={{SpeechBrain}: A General-Purpose Speech Toolkit},
author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
year={2021},
eprint={2106.04624},
archivePrefix={arXiv},
primaryClass={eess.AS},
note={arXiv:2106.04624}
}


speechbrain/tts-tacotron2-ljspeech
收录说明:
1、本网页并非 speechbrain/tts-tacotron2-ljspeech 官网网址页面,此页面内容编录于互联网,只作展示之用;
2、如果有与 speechbrain/tts-tacotron2-ljspeech 相关业务事宜,请访问其网站并获取联系方式;
3、本站与 speechbrain/tts-tacotron2-ljspeech 无任何关系,对于 speechbrain/tts-tacotron2-ljspeech 网站中的信息,请用户谨慎辨识其真伪。
4、本站收录 speechbrain/tts-tacotron2-ljspeech 时,此站内容访问正常,如遇跳转非法网站,有可能此网站被非法入侵或者已更换新网址,导致旧网址被非法使用,
5、如果你是网站站长或者负责人,不想被收录请邮件删除:i-hu#Foxmail.com (#换@)

前往AI网址导航
© 版权声明

相关文章