Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: "de"
|
3 |
+
inference: false
|
4 |
+
tags:
|
5 |
+
- Vocoder
|
6 |
+
- HiFIGAN
|
7 |
+
- text-to-speech
|
8 |
+
- TTS
|
9 |
+
- speech-synthesis
|
10 |
+
- speechbrain
|
11 |
+
license: "apache-2.0"
|
12 |
+
datasets:
|
13 |
+
- custom
|
14 |
+
---
|
15 |
+
|
16 |
+
# Vocoder with HiFIGAN trained on custom German dataset
|
17 |
+
|
18 |
+
This repository provides all the necessary tools for using a [HiFIGAN](https://arxiv.org/abs/2010.05646) vocoder trained on a generated German dataset using [mp3_to_training_data](https://github.com/padmalcom/mp3_to_training_data).
|
19 |
+
|
20 |
+
The pre-trained model (8 epochs so far) takes in input a spectrogram and produces a waveform in output. Typically, a vocoder is used after a TTS model that converts an input text into a spectrogram.
|
21 |
+
|
22 |
+
|
23 |
+
## How to use
|
24 |
+
|
25 |
+
Install speechbrain.
|
26 |
+
|
27 |
+
```bash
|
28 |
+
pip install speechbrain
|
29 |
+
```
|
30 |
+
|
31 |
+
Use a TTS model (e.g. [tts-tacotron-german](https://huggingface.co/padmalcom/tts-tacotron2-german)), generate a spectrogram and convert it to audio.
|
32 |
+
|
33 |
+
```python
|
34 |
+
import torchaudio
|
35 |
+
from speechbrain.pretrained import Tacotron2
|
36 |
+
from speechbrain.pretrained import HIFIGAN
|
37 |
+
|
38 |
+
tacotron2 = Tacotron2.from_hparams(source="padmalcom/tts-tacotron2-german", savedir="tmpdir_tts")
|
39 |
+
hifi_gan = HIFIGAN.from_hparams(source="padmalcom/tts-hifigan-german", savedir="tmpdir_vocoder")
|
40 |
+
|
41 |
+
mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")
|
42 |
+
|
43 |
+
waveforms = hifi_gan.decode_batch(mel_output)
|
44 |
+
|
45 |
+
torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 22050)
|
46 |
+
```
|
47 |
+
|
48 |
+
### Inference on GPU
|
49 |
+
To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
|