1
---
2
language: "en"
3
thumbnail:
4
tags:
5
- automatic-speech-recognition
6
- CTC
7
- Attention
8
- Transformer
9
- pytorch
10
- speechbrain
11
license: "apache-2.0"
12
datasets:
13
- librispeech
14
metrics:
15
- wer
16
- cer
17
---
18
19
<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>
20
<br/><br/>
21
22
# Transformer for LibriSpeech (with Transformer LM)
23
24
This repository provides all the necessary tools to perform automatic speech
25
recognition from an end-to-end system pretrained on LibriSpeech (EN) within
26
SpeechBrain. For a better experience, we encourage you to learn more about
27
[SpeechBrain](https://speechbrain.github.io). 
28
The performance of the model is the following:
29
30
| Release | Test clean WER | Test other WER | GPUs |
31
|:-------------:|:--------------:|:--------------:|:--------:|
32
| 05-03-21 | 2.46 | 5.86 | 2xV100 32GB |
33
34
## Pipeline description
35
36
This ASR system is composed of 3 different but linked blocks:
37
- Tokenizer (unigram) that transforms words into subword units and trained with
38
the train transcriptions of LibriSpeech.
39
- Neural language model (Transformer LM) trained on the full 10M words dataset.
40
- Acoustic model made of a transformer encoder and a joint decoder with CTC +
41
transformer. Hence, the decoding also incorporates the CTC probabilities.
42
43
The system is trained with recordings sampled at 16kHz (single channel).
44
The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling *transcribe_file* if needed.
45
46
## Install SpeechBrain
47
48
First of all, please install SpeechBrain with the following command:
49
50
```
51
pip install speechbrain
52
```
53
54
Please notice that we encourage you to read our tutorials and learn more about
55
[SpeechBrain](https://speechbrain.github.io).
56
57
### Transcribing your own audio files (in English)
58
59
```python
60
from speechbrain.pretrained import EncoderDecoderASR
61
62
asr_model = EncoderDecoderASR.from_hparams(source="speechbrain/asr-transformer-transformerlm-librispeech", savedir="pretrained_models/asr-transformer-transformerlm-librispeech")
63
asr_model.transcribe_file("speechbrain/asr-transformer-transformerlm-librispeech/example.wav")
64
65
```
66
### Inference on GPU
67
To perform inference on the GPU, add  `run_opts={"device":"cuda"}`  when calling the `from_hparams` method.
68
69
## Parallel Inference on a Batch
70
Please, [see this Colab notebook](https://colab.research.google.com/drive/1hX5ZI9S4jHIjahFCZnhwwQmFoGAi3tmu?usp=sharing) to figure out how to transcribe in parallel a batch of input sentences using a pre-trained model.
71
72
### Training
73
The model was trained with SpeechBrain (Commit hash: 'f73fcc35').
74
To train it from scratch follow these steps:
75
1. Clone SpeechBrain:
76
```bash
77
git clone https://github.com/speechbrain/speechbrain/
78
```
79
2. Install it:
80
```bash
81
cd speechbrain
82
pip install -r requirements.txt
83
pip install -e .
84
```
85
86
3. Run Training:
87
```bash
88
cd recipes/LibriSpeech/ASR/transformer
89
python train.py hparams/transformer.yaml --data_folder=your_data_folder
90
```
91
92
You can find our training results (models, logs, etc) [here](https://drive.google.com/drive/folders/1ZudxqMWb8VNCJKvY2Ws5oNY3WI1To0I7?usp=sharing).
93
94
### Limitations
95
The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
96
97
# **About SpeechBrain**
98
- Website: https://speechbrain.github.io/
99
- Code: https://github.com/speechbrain/speechbrain/
100
- HuggingFace: https://huggingface.co/speechbrain/
101
102
103
# **Citing SpeechBrain**
104
Please, cite SpeechBrain if you use it for your research or business.
105
106
107
```bibtex
108
@misc{speechbrain,
109
  title={{SpeechBrain}: A General-Purpose Speech Toolkit},
110
  author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
111
  year={2021},
112
  eprint={2106.04624},
113
  archivePrefix={arXiv},
114
  primaryClass={eess.AS},
115
  note={arXiv:2106.04624}
116
}
117
```
118