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.
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.
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.
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.
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!
python
1from transformers import pipeline
2from datasets import load_dataset
3import soundfile as sf
45synthesiser = pipeline("text-to-speech","microsoft/speecht5_tts")67embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")8speaker_embedding = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)9# You can replace this embedding with your own as well.1011speech = synthesiser("Hello, my dog is cooler than you!", forward_params={"speaker_embeddings": speaker_embedding})1213sf.write("speech.wav", speech["audio"], samplerate=speech["sampling_rate"])
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.
python
1from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech, SpeechT5HifiGan
2from datasets import load_dataset
3import torch
4import soundfile as sf
5from datasets import load_dataset
67processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")8model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts")9vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")1011inputs = processor(text="Hello, my dog is cute.", return_tensors="pt")1213# load xvector containing speaker's voice characteristics from a dataset14embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")15speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)1617speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder)1819sf.write("speech.wav", speech.numpy(), samplerate=16000)
Fine-tuning the Model
Refer to this Colab notebook for an example of how to fine-tune SpeechT5 for TTS on a different dataset or a new language.
Direct Use
You can use this model for speech synthesis. See the model hub to look for fine-tuned versions on a task that interests you.
Downstream Use [optional]
[More Information Needed]
Out-of-Scope Use
[More Information Needed]
Bias, Risks, and Limitations
[More Information Needed]
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Training Data
LibriTTS
Training Procedure
Preprocessing [optional]
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.
Training hyperparameters
Precision: [More Information Needed]
Regime: [More Information Needed]
Speeds, Sizes, Times [optional]
[More Information Needed]
Evaluation
Testing Data, Factors & Metrics
Testing Data
[More Information Needed]
Factors
[More Information Needed]
Metrics
[More Information Needed]
Results
[More Information Needed]
Summary
Model Examination [optional]
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.
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.
Compute Infrastructure
[More Information Needed]
Hardware
[More Information Needed]
Software
[More Information Needed]
Citation [optional]
BibTeX:
bibtex
1@inproceedings{ao-etal-2022-speecht5,
2 title = {{S}peech{T}5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing},
3 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},
4 booktitle = {Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
5 month = {May},
6 year = {2022},
7 pages={5723--5738},
8}
Glossary [optional]
text-to-speech to synthesize audio
More Information [optional]
[More Information Needed]
Model Card Authors [optional]
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.