patrickvonplaten commited on
Commit
2c73378
1 Parent(s): 5414c23

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +63 -0
README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: multi-lingual
3
+ datasets:
4
+ - common_voice
5
+ tags:
6
+ - speech
7
+ - audio
8
+ - automatic-speech-recognition
9
+ - phoneme-recognition
10
+ widget:
11
+ - example_title: Librispeech sample 1
12
+ src: https://cdn-media.huggingface.co/speech_samples/sample1.flac
13
+ - example_title: Librispeech sample 2
14
+ src: https://cdn-media.huggingface.co/speech_samples/sample2.flac
15
+ license: apache-2.0
16
+ ---
17
+
18
+ # Wav2Vec2-Large-XLSR-53 finetuned on multi-lingual Common Voice
19
+
20
+ This checkpoint leverages the pretrained checkpoint [wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53)
21
+ and is fine-tuned on [CommonVoice](https://huggingface.co/datasets/common_voice) to recognize phonetic labels in multiple languages.
22
+
23
+ When using the model make sure that your speech input is sampled at 16kHz.
24
+ Note that the model outputs a string of phonetic labels. A dictionary mapping phonetic labels to words
25
+ has to be used to map the phonetic output labels to output words.
26
+
27
+ [Paper: Simple and Effective Zero-shot Cross-lingual Phoneme Recognition](https://arxiv.org/abs/2109.11680)
28
+
29
+ Authors: Qiantong Xu, Alexei Baevski, Michael Auli
30
+
31
+ **Abstract**
32
+ Recent progress in self-training, self-supervised pretraining and unsupervised learning enabled well performing speech recognition systems without any labeled data. However, in many cases there is labeled data available for related languages which is not utilized by these methods. This paper extends previous work on zero-shot cross-lingual transfer learning by fine-tuning a multilingually pretrained wav2vec 2.0 model to transcribe unseen languages. This is done by mapping phonemes of the training languages to the target language using articulatory features. Experiments show that this simple method significantly outperforms prior work which introduced task-specific architectures and used only part of a monolingually pretrained model.
33
+
34
+ The original model can be found under https://github.com/pytorch/fairseq/tree/master/examples/wav2vec#wav2vec-20.
35
+
36
+ # Usage
37
+
38
+ To transcribe audio files the model can be used as a standalone acoustic model as follows:
39
+
40
+ ```python
41
+ from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
42
+ from datasets import load_dataset
43
+ import torch
44
+
45
+ # load model and processor
46
+ processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-xlsr-53-espeak-cv-ft")
47
+ model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-xlsr-53-espeak-cv-ft")
48
+
49
+ # load dummy dataset and read soundfiles
50
+ ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
51
+
52
+ # tokenize
53
+ input_values = processor(ds[0]["audio"]["array"], return_tensors="pt").input_values
54
+
55
+ # retrieve logits
56
+ with torch.no_grad():
57
+ logits = model(input_values).logits
58
+
59
+ # take argmax and decode
60
+ predicted_ids = torch.argmax(logits, dim=-1)
61
+ transcription = processor.batch_decode(predicted_ids)
62
+ # => should give ['m ɪ s t ɚ k w ɪ l t ɚ ɪ z ð ɪ ɐ p ɑː s əl l ʌ v ð ə m ɪ d əl k l æ s ɪ z æ n d w iː aʊ ɡ l æ d t ə w ɛ l k ə m h ɪ z ɡ ɑː s p ə']
63
+ ```