Update README.md
Browse files
README.md
CHANGED
@@ -40,11 +40,11 @@ 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="
|
44 |
-
hifi_gan = HIFIGAN.from_hparams(source="
|
45 |
|
46 |
# Running the TTS
|
47 |
-
mel_output, mel_length, alignment = tacotron2.encode_text("
|
48 |
|
49 |
# Running Vocoder (spectrogram-to-waveform)
|
50 |
waveforms = hifi_gan.decode_batch(mel_output)
|
@@ -53,42 +53,6 @@ waveforms = hifi_gan.decode_batch(mel_output)
|
|
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.
|
|
|
40 |
from speechbrain.inference.vocoders import HIFIGAN
|
41 |
|
42 |
# Intialize TTS (tacotron2) and Vocoder (HiFIGAN)
|
43 |
+
tacotron2 = Tacotron2.from_hparams(source="Sulaimank/tts-tacotron2-commonvoice-single-female", savedir="tmpdir_tts")
|
44 |
+
hifi_gan = HIFIGAN.from_hparams(source="Sulaimank/tts-hifigan-commonvoice-single-female", savedir="tmpdir_vocoder")
|
45 |
|
46 |
# Running the TTS
|
47 |
+
mel_output, mel_length, alignment = tacotron2.encode_text("Obwedda ndowooza wagenze.")
|
48 |
|
49 |
# Running Vocoder (spectrogram-to-waveform)
|
50 |
waveforms = hifi_gan.decode_batch(mel_output)
|
|
|
53 |
torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 22050)
|
54 |
```
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
### Limitations
|
58 |
The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
|