Text-to-Speech
ESPnet
speecht5
audio
gitgato commited on
Commit
b28845a
1 Parent(s): a09c25f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +269 -3
README.md CHANGED
@@ -1,3 +1,269 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - audio
5
+ - text-to-speech
6
+ datasets:
7
+ - libritts
8
+ ---
9
+
10
+ # SpeechT5 (TTS task)
11
+
12
+ SpeechT5 model fine-tuned for speech synthesis (text-to-speech) on LibriTTS.
13
+
14
+ This model was introduced in [SpeechT5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing](https://arxiv.org/abs/2110.07205) by Junyi Ao, Rui Wang, Long Zhou, Chengyi Wang, Shuo Ren, Yu Wu, Shujie Liu, Tom Ko, Qing Li, Yu Zhang, Zhihua Wei, Yao Qian, Jinyu Li, Furu Wei.
15
+
16
+ SpeechT5 was first released in [this repository](https://github.com/microsoft/SpeechT5/), [original weights](https://huggingface.co/mechanicalsea/speecht5-tts). The license used is [MIT](https://github.com/microsoft/SpeechT5/blob/main/LICENSE).
17
+
18
+
19
+
20
+ ## Model Description
21
+
22
+ Motivated by the success of T5 (Text-To-Text Transfer Transformer) in pre-trained natural language processing models, we propose a unified-modal SpeechT5 framework that explores the encoder-decoder pre-training for self-supervised speech/text representation learning. The SpeechT5 framework consists of a shared encoder-decoder network and six modal-specific (speech/text) pre/post-nets. After preprocessing the input speech/text through the pre-nets, the shared encoder-decoder network models the sequence-to-sequence transformation, and then the post-nets generate the output in the speech/text modality based on the output of the decoder.
23
+
24
+ Leveraging large-scale unlabeled speech and text data, we pre-train SpeechT5 to learn a unified-modal representation, hoping to improve the modeling capability for both speech and text. To align the textual and speech information into this unified semantic space, we propose a cross-modal vector quantization approach that randomly mixes up speech/text states with latent units as the interface between encoder and decoder.
25
+
26
+ Extensive evaluations show the superiority of the proposed SpeechT5 framework on a wide variety of spoken language processing tasks, including automatic speech recognition, speech synthesis, speech translation, voice conversion, speech enhancement, and speaker identification.
27
+
28
+ - **Developed by:** Junyi Ao, Rui Wang, Long Zhou, Chengyi Wang, Shuo Ren, Yu Wu, Shujie Liu, Tom Ko, Qing Li, Yu Zhang, Zhihua Wei, Yao Qian, Jinyu Li, Furu Wei.
29
+ - **Shared by [optional]:** [Matthijs Hollemans](https://huggingface.co/Matthijs)
30
+ - **Model type:** text-to-speech
31
+ - **Language(s) (NLP):** [More Information Needed]
32
+ - **License:** [MIT](https://github.com/microsoft/SpeechT5/blob/main/LICENSE)
33
+ - **Finetuned from model [optional]:** [More Information Needed]
34
+
35
+
36
+ ## Model Sources [optional]
37
+
38
+ <!-- Provide the basic links for the model. -->
39
+
40
+ - **Repository:** [https://github.com/microsoft/SpeechT5/]
41
+ - **Paper:** [https://arxiv.org/pdf/2110.07205.pdf]
42
+ - **Blog Post:** [https://huggingface.co/blog/speecht5]
43
+ - **Demo:** [https://huggingface.co/spaces/Matthijs/speecht5-tts-demo]
44
+
45
+
46
+ # Uses
47
+
48
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
49
+
50
+ ## 🤗 Transformers Usage
51
+
52
+ You can run SpeechT5 TTS locally with the 🤗 Transformers library.
53
+
54
+ 1. First install the 🤗 [Transformers library](https://github.com/huggingface/transformers), sentencepiece, soundfile and datasets(optional):
55
+
56
+ ```
57
+ pip install --upgrade pip
58
+ pip install --upgrade transformers sentencepiece datasets[audio]
59
+ ```
60
+
61
+ 2. Run inference via the `Text-to-Speech` (TTS) pipeline. You can access the SpeechT5 model via the TTS pipeline in just a few lines of code!
62
+
63
+ ```python
64
+ from transformers import pipeline
65
+ from datasets import load_dataset
66
+ import soundfile as sf
67
+
68
+ synthesiser = pipeline("text-to-speech", "microsoft/speecht5_tts")
69
+
70
+ embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
71
+ speaker_embedding = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
72
+ # You can replace this embedding with your own as well.
73
+
74
+ speech = synthesiser("Hello, my dog is cooler than you!", forward_params={"speaker_embeddings": speaker_embedding})
75
+
76
+ sf.write("speech.wav", speech["audio"], samplerate=speech["sampling_rate"])
77
+ ```
78
+
79
+ 3. Run inference via the Transformers modelling code - You can use the processor + generate code to convert text into a mono 16 kHz speech waveform for more fine-grained control.
80
+
81
+ ```python
82
+ from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
83
+ from datasets import load_dataset
84
+ import torch
85
+ import soundfile as sf
86
+ from datasets import load_dataset
87
+
88
+ processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
89
+ model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts")
90
+ vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")
91
+
92
+ inputs = processor(text="Hello, my dog is cute.", return_tensors="pt")
93
+
94
+ # load xvector containing speaker's voice characteristics from a dataset
95
+ embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
96
+ speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
97
+
98
+ speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)
99
+
100
+ sf.write("speech.wav", speech.numpy(), samplerate=16000)
101
+ ```
102
+
103
+ ### Fine-tuning the Model
104
+
105
+ Refer to [this Colab notebook](https://colab.research.google.com/drive/1i7I5pzBcU3WDFarDnzweIj4-sVVoIUFJ) for an example of how to fine-tune SpeechT5 for TTS on a different dataset or a new language.
106
+
107
+
108
+ ## Direct Use
109
+
110
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
111
+
112
+ You can use this model for speech synthesis. See the [model hub](https://huggingface.co/models?search=speecht5) to look for fine-tuned versions on a task that interests you.
113
+
114
+ ## Downstream Use [optional]
115
+
116
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
117
+
118
+ [More Information Needed]
119
+
120
+ ## Out-of-Scope Use
121
+
122
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
123
+
124
+ [More Information Needed]
125
+
126
+ # Bias, Risks, and Limitations
127
+
128
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
129
+
130
+ [More Information Needed]
131
+
132
+ ## Recommendations
133
+
134
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
135
+
136
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
137
+
138
+ ## Training Data
139
+
140
+ <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
141
+
142
+ LibriTTS
143
+
144
+ ## Training Procedure
145
+
146
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
147
+
148
+ ### Preprocessing [optional]
149
+
150
+ Leveraging large-scale unlabeled speech and text data, we pre-train SpeechT5 to learn a unified-modal representation, hoping to improve the modeling capability for both speech and text.
151
+
152
+
153
+ ### Training hyperparameters
154
+ - **Precision:** [More Information Needed] <!--fp16, bf16, fp8, fp32 -->
155
+ - **Regime:** [More Information Needed] <!--mixed precision or not -->
156
+
157
+ ### Speeds, Sizes, Times [optional]
158
+
159
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
160
+
161
+ [More Information Needed]
162
+
163
+ # Evaluation
164
+
165
+ <!-- This section describes the evaluation protocols and provides the results. -->
166
+
167
+ ## Testing Data, Factors & Metrics
168
+
169
+ ### Testing Data
170
+
171
+ <!-- This should link to a Data Card if possible. -->
172
+
173
+ [More Information Needed]
174
+
175
+ ### Factors
176
+
177
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
178
+
179
+ [More Information Needed]
180
+
181
+ ### Metrics
182
+
183
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
184
+
185
+ [More Information Needed]
186
+
187
+ ## Results
188
+
189
+ [More Information Needed]
190
+
191
+ ### Summary
192
+
193
+
194
+
195
+ # Model Examination [optional]
196
+
197
+ <!-- Relevant interpretability work for the model goes here -->
198
+
199
+ Extensive evaluations show the superiority of the proposed SpeechT5 framework on a wide variety of spoken language processing tasks, including automatic speech recognition, speech synthesis, speech translation, voice conversion, speech enhancement, and speaker identification.
200
+
201
+ # Environmental Impact
202
+
203
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
204
+
205
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
206
+
207
+ - **Hardware Type:** [More Information Needed]
208
+ - **Hours used:** [More Information Needed]
209
+ - **Cloud Provider:** [More Information Needed]
210
+ - **Compute Region:** [More Information Needed]
211
+ - **Carbon Emitted:** [More Information Needed]
212
+
213
+ # Technical Specifications [optional]
214
+
215
+ ## Model Architecture and Objective
216
+
217
+ The SpeechT5 framework consists of a shared encoder-decoder network and six modal-specific (speech/text) pre/post-nets.
218
+
219
+ After preprocessing the input speech/text through the pre-nets, the shared encoder-decoder network models the sequence-to-sequence transformation, and then the post-nets generate the output in the speech/text modality based on the output of the decoder.
220
+
221
+ ## Compute Infrastructure
222
+
223
+ [More Information Needed]
224
+
225
+ ### Hardware
226
+
227
+ [More Information Needed]
228
+
229
+ ### Software
230
+
231
+ [More Information Needed]
232
+
233
+ # Citation [optional]
234
+
235
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
236
+
237
+ **BibTeX:**
238
+
239
+ ```bibtex
240
+ @inproceedings{ao-etal-2022-speecht5,
241
+ title = {{S}peech{T}5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing},
242
+ author = {Ao, Junyi and Wang, Rui and Zhou, Long and Wang, Chengyi and Ren, Shuo and Wu, Yu and Liu, Shujie and Ko, Tom and Li, Qing and Zhang, Yu and Wei, Zhihua and Qian, Yao and Li, Jinyu and Wei, Furu},
243
+ booktitle = {Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
244
+ month = {May},
245
+ year = {2022},
246
+ pages={5723--5738},
247
+ }
248
+ ```
249
+
250
+ # Glossary [optional]
251
+
252
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
253
+
254
+ - **text-to-speech** to synthesize audio
255
+
256
+ # More Information [optional]
257
+
258
+ [More Information Needed]
259
+
260
+ # Model Card Authors [optional]
261
+
262
+ Disclaimer: The team releasing SpeechT5 did not write a model card for this model so this model card has been written by the Hugging Face team.
263
+
264
+ # Model Card Contact
265
+
266
+ [More Information Needed]
267
+
268
+
269
+