Loading...
HF音频

speechbrain/tts-tacotron2-ljspeech

Text-to-Speech (TTS) with T...

标签:


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浏览人数已经达到868,如你需要查询该站的相关权重信息,可以点击"5118数据""爱站数据""Chinaz数据"进入;以目前的网站数据参考,建议大家请以爱站数据为准,更多网站价值评估因素如:speechbrain/tts-tacotron2-ljspeech的访问速度、搜索引擎收录以及索引量、用户体验等;当然要评估一个站的价值,最主要还是需要根据您自身的需求以及需要,一些确切的数据则需要找speechbrain/tts-tacotron2-ljspeech的站长进行洽谈提供。如该站的IP、PV、跳出率等!

关于speechbrain/tts-tacotron2-ljspeech特别声明

本站Ai导航提供的speechbrain/tts-tacotron2-ljspeech都来源于网络,不保证外部链接的准确性和完整性,同时,对于该外部链接的指向,不由Ai导航实际控制,在2023年5月15日 下午3:17收录时,该网页上的内容,都属于合规合法,后期网页的内容如出现违规,可以直接联系网站管理员进行删除,Ai导航不承担任何责任。

相关导航

暂无评论

暂无评论...