Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,83 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- fr
|
4 |
+
- en
|
5 |
+
inference: false
|
6 |
+
tags:
|
7 |
+
- speech-to-speech-translation
|
8 |
+
- speechbrain
|
9 |
license: apache-2.0
|
10 |
+
datasets:
|
11 |
+
- CVSS
|
12 |
---
|
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 |
+
# Speech-to-Unit Translation trained on CVSS
|
19 |
+
|
20 |
+
This repository provides all the necessary tools for using a a speech-to-unit translation (S2UT) model using a pre-trained Wav2Vec 2.0 encoder and a transformer decoder on the [CVSS](https://arxiv.org/abs/2201.03713) dataset.
|
21 |
+
The implementation is based on [Textless Speech-to-Speech Translation](https://arxiv.org/abs/2112.08352) and [Enhanced Direct Speech-to-Speech Translation Using Self-supervised Pre-training and Data Augmentatio](https://arxiv.org/abs/2204.02967) papers.
|
22 |
+
|
23 |
+
The pre-trained model take as input waveform and produces discrete self-supervised representations as output. Typically, a vocoder (e.g., HiFiGAN Unit) is utilized on top of the S2UT model to produce waveform.
|
24 |
+
To generate the discrete self-supervised representations, we employ a K-means clustering model trained on the 6th layer of HuBERT, with `k=100`.
|
25 |
+
|
26 |
+
## Install SpeechBrain
|
27 |
+
|
28 |
+
First of all, please install tranformers and SpeechBrain with the following command:
|
29 |
+
|
30 |
+
```
|
31 |
+
pip install speechbrain transformers==4.28.0
|
32 |
+
```
|
33 |
+
|
34 |
+
Please notice that we encourage you to read our tutorials and learn more about
|
35 |
+
[SpeechBrain](https://speechbrain.github.io).
|
36 |
+
|
37 |
+
|
38 |
+
### Perform speech-to-speech translation (S2ST) with S2UT model and the Vocoder
|
39 |
+
```python
|
40 |
+
import torchaudio
|
41 |
+
from speechbrain.pretrained import EncoderDecoderS2UT
|
42 |
+
from speechbrain.pretrained import UnitHIFIGAN
|
43 |
+
|
44 |
+
# Intialize S2UT (Transformer) and Vocoder (HiFIGAN Unit)
|
45 |
+
s2ut = EncoderDecoderS2UT.from_hparams(source="speechbrain/s2st-transformer-fr-en-hubert-l6-k100-cvss", savedir=tmpdir_s2ut)
|
46 |
+
hifi_gan_unit = UnitHIFIGAN.from_hparams(source="speechbrain/tts-hifigan-unit-hubert-l6-k100-ljspeech", savedir=tmpdir_vocoder)
|
47 |
+
|
48 |
+
# Running the S2UT model
|
49 |
+
codes = s2ut.translate_file("speechbrain/s2st-transformer-fr-en-hubert-l6-k100-cvss/example-fr.wav")
|
50 |
+
|
51 |
+
# Running Vocoder (units-to-waveform)
|
52 |
+
waveforms = hifi_gan.decode_unit(codes)
|
53 |
+
|
54 |
+
# Save the waverform
|
55 |
+
torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 16000)
|
56 |
+
```
|
57 |
+
|
58 |
+
### Inference on GPU
|
59 |
+
To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
|
60 |
+
|
61 |
+
|
62 |
+
### Limitations
|
63 |
+
The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
|
64 |
+
|
65 |
+
#### Referencing SpeechBrain
|
66 |
+
|
67 |
+
```
|
68 |
+
@misc{SB2021,
|
69 |
+
author = {Ravanelli, Mirco and Parcollet, Titouan and Rouhe, Aku and Plantinga, Peter and Rastorgueva, Elena and Lugosch, Loren and Dawalatabad, Nauman and Ju-Chieh, Chou and Heba, Abdel and Grondin, Francois and Aris, William and Liao, Chien-Feng and Cornell, Samuele and Yeh, Sung-Lin and Na, Hwidong and Gao, Yan and Fu, Szu-Wei and Subakan, Cem and De Mori, Renato and Bengio, Yoshua },
|
70 |
+
title = {SpeechBrain},
|
71 |
+
year = {2021},
|
72 |
+
publisher = {GitHub},
|
73 |
+
journal = {GitHub repository},
|
74 |
+
howpublished = {\\\\url{https://github.com/speechbrain/speechbrain}},
|
75 |
+
}
|
76 |
+
```
|
77 |
+
|
78 |
+
#### About SpeechBrain
|
79 |
+
SpeechBrain is an open-source and all-in-one speech toolkit. It is designed to be simple, extremely flexible, and user-friendly. Competitive or state-of-the-art performance is obtained in various domains.
|
80 |
+
|
81 |
+
Website: https://speechbrain.github.io/
|
82 |
+
|
83 |
+
GitHub: https://github.com/speechbrain/speechbrain
|