Commit
•
cab6457
1
Parent(s):
a507bf2
Update README.md
Browse files
README.md
CHANGED
@@ -40,23 +40,43 @@ For the MMS project, a separate VITS checkpoint is trained on each langauge.
|
|
40 |
|
41 |
## Usage
|
42 |
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
```python
|
46 |
from transformers import VitsModel, AutoTokenizer
|
47 |
import torch
|
48 |
|
49 |
-
model = VitsModel.from_pretrained("
|
50 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
51 |
|
52 |
text = "Hey, it's Hugging Face on the phone"
|
53 |
inputs = tokenizer(text, return_tensors="pt")
|
54 |
|
55 |
with torch.no_grad():
|
56 |
output = model(**inputs).waveform
|
|
|
|
|
|
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
from IPython.display import Audio
|
59 |
-
|
|
|
60 |
```
|
61 |
|
62 |
## BibTex citation
|
|
|
40 |
|
41 |
## Usage
|
42 |
|
43 |
+
MMS-TTS is available in the 🤗 Transformers library from version 4.33 onwards. To use this checkpoint,
|
44 |
+
first install the latest version of the library:
|
45 |
+
|
46 |
+
```
|
47 |
+
pip install --upgrade transformers accelerate
|
48 |
+
```
|
49 |
+
|
50 |
+
Then, run inference with the following code-snippet:
|
51 |
|
52 |
```python
|
53 |
from transformers import VitsModel, AutoTokenizer
|
54 |
import torch
|
55 |
|
56 |
+
model = VitsModel.from_pretrained("facebook/mms-tts-eng")
|
57 |
+
tokenizer = AutoTokenizer.from_pretrained("facebook/mms-tts-eng")
|
58 |
|
59 |
text = "Hey, it's Hugging Face on the phone"
|
60 |
inputs = tokenizer(text, return_tensors="pt")
|
61 |
|
62 |
with torch.no_grad():
|
63 |
output = model(**inputs).waveform
|
64 |
+
```
|
65 |
+
|
66 |
+
The resulting waveform can be saved as a `.wav` file:
|
67 |
|
68 |
+
```python
|
69 |
+
import scipy
|
70 |
+
|
71 |
+
scipy.io.wavfile.write("techno.wav", rate=model.config.sampling_rate, data=output)
|
72 |
+
```
|
73 |
+
|
74 |
+
Or displayed in a Jupyter Notebook / Google Colab:
|
75 |
+
|
76 |
+
```python
|
77 |
from IPython.display import Audio
|
78 |
+
|
79 |
+
Audio(output, rate=model.config.sampling_rate)
|
80 |
```
|
81 |
|
82 |
## BibTex citation
|