sulaimank commited on
Commit
48095d1
1 Parent(s): db0bf27

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +113 -1
README.md CHANGED
@@ -1,3 +1,115 @@
1
  ---
2
- license: cc-by-4.0
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - lg
4
+ tags:
5
+ - text-to-speech
6
+ - TTS
7
+ - speech-synthesis
8
+ - Tacotron2
9
+ license: apache-2.0
10
+ datasets:
11
+ - mozilla-foundation/common_voice_16_1
12
+ pipeline_tag: text-to-speech
13
  ---
14
+
15
+ <iframe src="https://ghbtns.com/github-btn.html?user=speechbrain&repo=speechbrain&type=star&count=true&size=large&v=2" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
16
+ <br/><br/>
17
+
18
+
19
+ # Text-to-Speech (TTS) with Tacotron2 trained on Common Voice
20
+
21
+ This repository provides all the necessary tools for Text-to-Speech (TTS) with SpeechBrain using a [Tacotron2](https://arxiv.org/abs/1712.05884) pretrained on [LJSpeech](https://keithito.com/LJ-Speech-Dataset/).
22
+
23
+ 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.
24
+
25
+
26
+ ## Install SpeechBrain
27
+
28
+ ```
29
+ pip install speechbrain
30
+ ```
31
+
32
+ Please notice that we encourage you to read our tutorials and learn more about
33
+ [SpeechBrain](https://speechbrain.github.io).
34
+
35
+ ### Perform Text-to-Speech (TTS)
36
+
37
+ ```python
38
+ import torchaudio
39
+ from speechbrain.inference.TTS import Tacotron2
40
+ from speechbrain.inference.vocoders import HIFIGAN
41
+
42
+ # Intialize TTS (tacotron2) and Vocoder (HiFIGAN)
43
+ tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech", savedir="tmpdir_tts")
44
+ hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-ljspeech", savedir="tmpdir_vocoder")
45
+
46
+ # Running the TTS
47
+ mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")
48
+
49
+ # Running Vocoder (spectrogram-to-waveform)
50
+ waveforms = hifi_gan.decode_batch(mel_output)
51
+
52
+ # Save the waverform
53
+ torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 22050)
54
+ ```
55
+
56
+ If you want to generate multiple sentences in one-shot, you can do in this way:
57
+
58
+ ```
59
+ from speechbrain.pretrained import Tacotron2
60
+ tacotron2 = Tacotron2.from_hparams(source="speechbrain/TTS_Tacotron2", savedir="tmpdir")
61
+ items = [
62
+ "A quick brown fox jumped over the lazy dog",
63
+ "How much wood would a woodchuck chuck?",
64
+ "Never odd or even"
65
+ ]
66
+ mel_outputs, mel_lengths, alignments = tacotron2.encode_batch(items)
67
+
68
+ ```
69
+
70
+ ### Inference on GPU
71
+ To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
72
+
73
+ ### Training
74
+ The model was trained with SpeechBrain.
75
+ To train it from scratch follow these steps:
76
+ 1. Clone SpeechBrain:
77
+ ```bash
78
+ git clone https://github.com/speechbrain/speechbrain/
79
+ ```
80
+ 2. Install it:
81
+ ```bash
82
+ cd speechbrain
83
+ pip install -r requirements.txt
84
+ pip install -e .
85
+ ```
86
+ 3. Run Training:
87
+ ```bash
88
+ cd recipes/LJSpeech/TTS/tacotron2/
89
+ python train.py --device=cuda:0 --max_grad_norm=1.0 --data_folder=/your_folder/LJSpeech-1.1 hparams/train.yaml
90
+ ```
91
+ You can find our training results (models, logs, etc) [here](https://drive.google.com/drive/folders/1PKju-_Nal3DQqd-n0PsaHK-bVIOlbf26?usp=sharing).
92
+
93
+ ### Limitations
94
+ The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
95
+
96
+ # **About SpeechBrain**
97
+ - Website: https://speechbrain.github.io/
98
+ - Code: https://github.com/speechbrain/speechbrain/
99
+ - HuggingFace: https://huggingface.co/speechbrain/
100
+
101
+
102
+ # **Citing SpeechBrain**
103
+ Please, cite SpeechBrain if you use it for your research or business.
104
+
105
+ ```bibtex
106
+ @misc{speechbrain,
107
+ title={{SpeechBrain}: A General-Purpose Speech Toolkit},
108
+ 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},
109
+ year={2021},
110
+ eprint={2106.04624},
111
+ archivePrefix={arXiv},
112
+ primaryClass={eess.AS},
113
+ note={arXiv:2106.04624}
114
+ }
115
+ ```