Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
tags:
|
4 |
+
- audio
|
5 |
+
- automatic-speech-recognition
|
6 |
+
datasets:
|
7 |
+
- librispeech_asr
|
8 |
+
---
|
9 |
+
|
10 |
+
# SpeechT5 (ASR task)
|
11 |
+
|
12 |
+
SpeechT5 model fine-tuned for automatic speech recognition (speech-to-text) on LibriSpeech.
|
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/ajyy/SpeechT5/). The license used is [MIT](https://github.com/microsoft/SpeechT5/blob/main/LICENSE).
|
17 |
+
|
18 |
+
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.
|
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 |
+
## Intended Uses & Limitations
|
29 |
+
|
30 |
+
You can use this model for automatic speech recognition. See the [model hub](https://huggingface.co/models?search=speecht5) to look for fine-tuned versions on a task that interests you.
|
31 |
+
|
32 |
+
Currently, both the feature extractor and model support PyTorch.
|
33 |
+
|
34 |
+
## Citation
|
35 |
+
|
36 |
+
**BibTeX:**
|
37 |
+
|
38 |
+
```bibtex
|
39 |
+
@inproceedings{ao-etal-2022-speecht5,
|
40 |
+
title = {{S}peech{T}5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing},
|
41 |
+
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},
|
42 |
+
booktitle = {Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
|
43 |
+
month = {May},
|
44 |
+
year = {2022},
|
45 |
+
pages={5723--5738},
|
46 |
+
}
|
47 |
+
```
|
48 |
+
|
49 |
+
## How to Get Started With the Model
|
50 |
+
|
51 |
+
Use the code below to convert a mono 16 kHz speech waveform to text.
|
52 |
+
|
53 |
+
```python
|
54 |
+
from transformers import SpeechT5Processor, SpeechT5ForSpeechToText
|
55 |
+
from datasets import load_dataset
|
56 |
+
|
57 |
+
dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
|
58 |
+
dataset = dataset.sort("id")
|
59 |
+
sampling_rate = dataset.features["audio"].sampling_rate
|
60 |
+
example_speech = dataset[0]["audio"]["array"]
|
61 |
+
|
62 |
+
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_asr")
|
63 |
+
model = SpeechT5ForSpeechToText.from_pretrained("microsoft/speecht5_asr")
|
64 |
+
|
65 |
+
inputs = processor(audio=example_speech, sampling_rate=sampling_rate, return_tensors="pt")
|
66 |
+
|
67 |
+
predicted_ids = model.generate(**inputs, max_length=100)
|
68 |
+
|
69 |
+
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
|
70 |
+
print(transcription[0])
|
71 |
+
```
|