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|
31 |
+
- dv
|
32 |
+
- dz
|
33 |
+
- el
|
34 |
+
- en
|
35 |
+
- eo
|
36 |
+
- et
|
37 |
+
- eu
|
38 |
+
- ee
|
39 |
+
- fo
|
40 |
+
- fa
|
41 |
+
- fj
|
42 |
+
- fi
|
43 |
+
- fr
|
44 |
+
- fy
|
45 |
+
- ff
|
46 |
+
- ga
|
47 |
+
- gl
|
48 |
+
- gn
|
49 |
+
- gu
|
50 |
+
- zh
|
51 |
+
- ht
|
52 |
+
- ha
|
53 |
+
- he
|
54 |
+
- hi
|
55 |
+
- sh
|
56 |
+
- hu
|
57 |
+
- hy
|
58 |
+
- ig
|
59 |
+
- ia
|
60 |
+
- ms
|
61 |
+
- is
|
62 |
+
- it
|
63 |
+
- jv
|
64 |
+
- ja
|
65 |
+
- kn
|
66 |
+
- ka
|
67 |
+
- kk
|
68 |
+
- kr
|
69 |
+
- km
|
70 |
+
- ki
|
71 |
+
- rw
|
72 |
+
- ky
|
73 |
+
- ko
|
74 |
+
- kv
|
75 |
+
- lo
|
76 |
+
- la
|
77 |
+
- lv
|
78 |
+
- ln
|
79 |
+
- lt
|
80 |
+
- lb
|
81 |
+
- lg
|
82 |
+
- mh
|
83 |
+
- ml
|
84 |
+
- mr
|
85 |
+
- ms
|
86 |
+
- mk
|
87 |
+
- mg
|
88 |
+
- mt
|
89 |
+
- mn
|
90 |
+
- mi
|
91 |
+
- my
|
92 |
+
- zh
|
93 |
+
- nl
|
94 |
+
- 'no'
|
95 |
+
- 'no'
|
96 |
+
- ne
|
97 |
+
- ny
|
98 |
+
- oc
|
99 |
+
- om
|
100 |
+
- or
|
101 |
+
- os
|
102 |
+
- pa
|
103 |
+
- pl
|
104 |
+
- pt
|
105 |
+
- ms
|
106 |
+
- ps
|
107 |
+
- qu
|
108 |
+
- qu
|
109 |
+
- qu
|
110 |
+
- qu
|
111 |
+
- qu
|
112 |
+
- qu
|
113 |
+
- qu
|
114 |
+
- qu
|
115 |
+
- qu
|
116 |
+
- qu
|
117 |
+
- qu
|
118 |
+
- qu
|
119 |
+
- qu
|
120 |
+
- qu
|
121 |
+
- qu
|
122 |
+
- qu
|
123 |
+
- qu
|
124 |
+
- qu
|
125 |
+
- qu
|
126 |
+
- qu
|
127 |
+
- qu
|
128 |
+
- qu
|
129 |
+
- ro
|
130 |
+
- rn
|
131 |
+
- ru
|
132 |
+
- sg
|
133 |
+
- sk
|
134 |
+
- sl
|
135 |
+
- sm
|
136 |
+
- sn
|
137 |
+
- sd
|
138 |
+
- so
|
139 |
+
- es
|
140 |
+
- sq
|
141 |
+
- su
|
142 |
+
- sv
|
143 |
+
- sw
|
144 |
+
- ta
|
145 |
+
- tt
|
146 |
+
- te
|
147 |
+
- tg
|
148 |
+
- tl
|
149 |
+
- th
|
150 |
+
- ti
|
151 |
+
- ts
|
152 |
+
- tr
|
153 |
+
- uk
|
154 |
+
- ms
|
155 |
+
- vi
|
156 |
+
- wo
|
157 |
+
- xh
|
158 |
+
- ms
|
159 |
+
- yo
|
160 |
+
- ms
|
161 |
+
- zu
|
162 |
+
- za
|
163 |
+
license: cc-by-sa-4.0
|
164 |
+
datasets:
|
165 |
+
- google/fleurs
|
166 |
+
metrics:
|
167 |
+
- wer
|
168 |
---
|
169 |
|
170 |
+
# Massively Multilingual Speech (MMS) - Finetuned ASR - ALL
|
171 |
+
|
172 |
+
This checkpoint is a model fine-tuned for multi-lingual ASR and part of Facebook's [Massive Multilingual Speech project](https://research.facebook.com/publications/scaling-speech-technology-to-1000-languages/).
|
173 |
+
This checkpoint is based on the [Wav2Vec2 architecture](https://huggingface.co/docs/transformers/model_doc/wav2vec2) and makes use of adapter models to transcribe 100+ languages.
|
174 |
+
The checkpoint consists of **1 billion parameters** and has been fine-tuned from [facebook/mms-1b](https://huggingface.co/facebook/mms-1b) on 102 languages of [Fleurs](https://huggingface.co/datasets/google/fleurs).
|
175 |
+
|
176 |
+
## Table Of Content
|
177 |
+
|
178 |
+
- [Example](#example)
|
179 |
+
- [Supported Languages](#supported-languages)
|
180 |
+
- [Model details](#model-details)
|
181 |
+
- [Additional links](#additional-links)
|
182 |
+
|
183 |
+
## Example
|
184 |
+
|
185 |
+
This MMS checkpoint can be used with [Transformers](https://github.com/huggingface/transformers) to transcribe audio of 1107 different
|
186 |
+
languages. Let's look at a simple example.
|
187 |
+
|
188 |
+
First, we install transformers and some other libraries
|
189 |
+
```
|
190 |
+
pip install torch accelerate torchaudio datasets
|
191 |
+
pip install --upgrade transformers
|
192 |
+
````
|
193 |
+
|
194 |
+
**Note**: In order to use MMS you need to have at least `transformers >= 4.30` installed. If the `4.30` version
|
195 |
+
is not yet available [on PyPI](https://pypi.org/project/transformers/) make sure to install `transformers` from
|
196 |
+
source:
|
197 |
+
```
|
198 |
+
pip install git+https://github.com/huggingface/transformers.git
|
199 |
+
```
|
200 |
+
|
201 |
+
Next, we load a couple of audio samples via `datasets`. Make sure that the audio data is sampled to 16000 kHz.
|
202 |
+
|
203 |
+
```py
|
204 |
+
from datasets import load_dataset, Audio
|
205 |
+
|
206 |
+
# English
|
207 |
+
stream_data = load_dataset("mozilla-foundation/common_voice_13_0", "en", split="test", streaming=True)
|
208 |
+
stream_data = stream_data.cast_column("audio", Audio(sampling_rate=16000))
|
209 |
+
en_sample = next(iter(stream_data))["audio"]["array"]
|
210 |
+
|
211 |
+
# French
|
212 |
+
stream_data = load_dataset("mozilla-foundation/common_voice_13_0", "fr", split="test", streaming=True)
|
213 |
+
stream_data = stream_data.cast_column("audio", Audio(sampling_rate=16000))
|
214 |
+
fr_sample = next(iter(stream_data))["audio"]["array"]
|
215 |
+
```
|
216 |
+
|
217 |
+
Next, we load the model and processor
|
218 |
+
|
219 |
+
```py
|
220 |
+
from transformers import Wav2Vec2ForCTC, AutoProcessor
|
221 |
+
import torch
|
222 |
+
|
223 |
+
model_id = "facebook/mms-1b-fl102"
|
224 |
+
|
225 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
226 |
+
model = Wav2Vec2ForCTC.from_pretrained(model_id)
|
227 |
+
```
|
228 |
+
|
229 |
+
Now we process the audio data, pass the processed audio data to the model and transcribe the model output, just like we usually do for Wav2Vec2 models such as [facebook/wav2vec2-base-960h](https://huggingface.co/facebook/wav2vec2-base-960h)
|
230 |
+
|
231 |
+
```py
|
232 |
+
inputs = processor(en_sample, sampling_rate=16_000, return_tensors="pt")
|
233 |
+
|
234 |
+
with torch.no_grad():
|
235 |
+
outputs = model(**inputs).logits
|
236 |
+
|
237 |
+
ids = torch.argmax(outputs, dim=-1)[0]
|
238 |
+
transcription = processor.decode(ids)
|
239 |
+
# 'joe keton disapproved of films and buster also had reservations about the media'
|
240 |
+
```
|
241 |
+
|
242 |
+
We can now keep the same model in memory and simply switch out the language adapters by calling the convenient [`load_adapter()`]() function for the model and [`set_target_lang()`]() for the tokenizer. We pass the target language as an input - "fra" for French.
|
243 |
+
|
244 |
+
```py
|
245 |
+
processor.tokenizer.set_target_lang("fra")
|
246 |
+
model.load_adapter("fra")
|
247 |
+
|
248 |
+
inputs = processor(fr_sample, sampling_rate=16_000, return_tensors="pt")
|
249 |
+
|
250 |
+
with torch.no_grad():
|
251 |
+
outputs = model(**inputs).logits
|
252 |
+
|
253 |
+
ids = torch.argmax(outputs, dim=-1)[0]
|
254 |
+
transcription = processor.decode(ids)
|
255 |
+
# "ce dernier est volé tout au long de l'histoire romaine"
|
256 |
+
```
|
257 |
+
|
258 |
+
In the same way the language can be switched out for all other supported languages. Please have a look at:
|
259 |
+
```py
|
260 |
+
processor.tokenizer.vocab.keys()
|
261 |
+
```
|
262 |
+
|
263 |
+
For more details, please have a look at [the official docs](https://huggingface.co/docs/transformers/main/en/model_doc/mms).
|
264 |
+
|
265 |
+
## Supported Languages
|
266 |
+
|
267 |
+
This model supports 102 languages. Unclick the following to toogle all supported languages of this checkpoint in [ISO 639-3 code](https://en.wikipedia.org/wiki/ISO_639-3).
|
268 |
+
You can find more details about the languages and their ISO 649-3 codes in the [MMS Language Coverage Overview](https://dl.fbaipublicfiles.com/mms/misc/language_coverage_mms.html).
|
269 |
+
<details>
|
270 |
+
<summary>Click to toggle</summary>
|
271 |
+
|
272 |
+
- afr
|
273 |
+
- amh
|
274 |
+
- ara
|
275 |
+
- asm
|
276 |
+
- ast
|
277 |
+
- azj-script_latin
|
278 |
+
- bel
|
279 |
+
- ben
|
280 |
+
- bos
|
281 |
+
- bul
|
282 |
+
- cat
|
283 |
+
- ceb
|
284 |
+
- ces
|
285 |
+
- ckb
|
286 |
+
- cmn-script_simplified
|
287 |
+
- cym
|
288 |
+
- dan
|
289 |
+
- deu
|
290 |
+
- ell
|
291 |
+
- eng
|
292 |
+
- est
|
293 |
+
- fas
|
294 |
+
- fin
|
295 |
+
- fra
|
296 |
+
- ful
|
297 |
+
- gle
|
298 |
+
- glg
|
299 |
+
- guj
|
300 |
+
- hau
|
301 |
+
- heb
|
302 |
+
- hin
|
303 |
+
- hrv
|
304 |
+
- hun
|
305 |
+
- hye
|
306 |
+
- ibo
|
307 |
+
- ind
|
308 |
+
- isl
|
309 |
+
- ita
|
310 |
+
- jav
|
311 |
+
- jpn
|
312 |
+
- kam
|
313 |
+
- kan
|
314 |
+
- kat
|
315 |
+
- kaz
|
316 |
+
- kea
|
317 |
+
- khm
|
318 |
+
- kir
|
319 |
+
- kor
|
320 |
+
- lao
|
321 |
+
- lav
|
322 |
+
- lin
|
323 |
+
- lit
|
324 |
+
- ltz
|
325 |
+
- lug
|
326 |
+
- luo
|
327 |
+
- mal
|
328 |
+
- mar
|
329 |
+
- mkd
|
330 |
+
- mlt
|
331 |
+
- mon
|
332 |
+
- mri
|
333 |
+
- mya
|
334 |
+
- nld
|
335 |
+
- nob
|
336 |
+
- npi
|
337 |
+
- nso
|
338 |
+
- nya
|
339 |
+
- oci
|
340 |
+
- orm
|
341 |
+
- ory
|
342 |
+
- pan
|
343 |
+
- pol
|
344 |
+
- por
|
345 |
+
- pus
|
346 |
+
- ron
|
347 |
+
- rus
|
348 |
+
- slk
|
349 |
+
- slv
|
350 |
+
- sna
|
351 |
+
- snd
|
352 |
+
- som
|
353 |
+
- spa
|
354 |
+
- srp-script_latin
|
355 |
+
- swe
|
356 |
+
- swh
|
357 |
+
- tam
|
358 |
+
- tel
|
359 |
+
- tgk
|
360 |
+
- tgl
|
361 |
+
- tha
|
362 |
+
- tur
|
363 |
+
- ukr
|
364 |
+
- umb
|
365 |
+
- urd-script_arabic
|
366 |
+
- uzb-script_latin
|
367 |
+
- vie
|
368 |
+
- wol
|
369 |
+
- xho
|
370 |
+
- yor
|
371 |
+
- yue-script_traditional
|
372 |
+
- zlm
|
373 |
+
- zul
|
374 |
+
|
375 |
+
</details>
|
376 |
+
|
377 |
+
## Model details
|
378 |
+
|
379 |
+
- **Developed by:** Vineel Pratap et al.
|
380 |
+
- **Model type:** Multi-Lingual Automatic Speech Recognition model
|
381 |
+
- **Language(s):** 1107+ languages, see [supported languages](#supported-languages)
|
382 |
+
- **License:** CC-BY-NC 4.0 license
|
383 |
+
- **Num parameters**: 1 billion
|
384 |
+
- **Cite as:**
|
385 |
+
|
386 |
+
@article{pratap2023mms,
|
387 |
+
title={Scaling Speech Technology to 1,000+ Languages},
|
388 |
+
author={Vineel Pratap and Andros Tjandra and Bowen Shi and Paden Tomasello and Arun Babu and Sayani Kundu and Ali Elkahky and Zhaoheng Ni and Apoorv Vyas and Maryam Fazel-Zarandi and Alexei Baevski and Yossi Adi and Xiaohui Zhang and Wei-Ning Hsu and Alexis Conneau and Michael Auli},
|
389 |
+
journal={arXiv},
|
390 |
+
year={2023}
|
391 |
+
}
|
392 |
+
|
393 |
+
## Additional Links
|
394 |
+
|
395 |
+
- [Blog post]( )
|
396 |
+
- [Transformers documentation](https://huggingface.co/docs/transformers/main/en/model_doc/mms).
|
397 |
+
- [Paper](https://arxiv.org/abs/2305.13516)
|
398 |
+
- [GitHub Repository](https://github.com/facebookresearch/fairseq/tree/main/examples/mms#asr)
|
399 |
+
- [Other **MMS** checkpoints](https://huggingface.co/models?other=mms)
|
400 |
+
- [Official Space](https://huggingface.co/spaces/facebook/MMS)
|