anuragshas commited on
Commit
cbf7f0b
1 Parent(s): 3288d21

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +71 -3
README.md CHANGED
@@ -6,11 +6,40 @@ tags:
6
  - automatic-speech-recognition
7
  - mozilla-foundation/common_voice_8_0
8
  - generated_from_trainer
 
9
  datasets:
10
- - common_voice
11
  model-index:
12
- - name: ''
13
- results: []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ---
15
 
16
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
@@ -74,3 +103,42 @@ The following hyperparameters were used during training:
74
  - Pytorch 1.10.2+cu102
75
  - Datasets 1.18.2.dev0
76
  - Tokenizers 0.11.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  - automatic-speech-recognition
7
  - mozilla-foundation/common_voice_8_0
8
  - generated_from_trainer
9
+ - robust-speech-event
10
  datasets:
11
+ - mozilla-foundation/common_voice_8_0
12
  model-index:
13
+ - name: XLS-R-300M - Slovenian
14
+ results:
15
+ - task:
16
+ name: Automatic Speech Recognition
17
+ type: automatic-speech-recognition
18
+ dataset:
19
+ name: Common Voice 8
20
+ type: mozilla-foundation/common_voice_8_0
21
+ args: sl
22
+ metrics:
23
+ - name: Test WER
24
+ type: wer
25
+ value: 12.736
26
+ - name: Test CER
27
+ type: cer
28
+ value: 3.605
29
+ - task:
30
+ name: Automatic Speech Recognition
31
+ type: automatic-speech-recognition
32
+ dataset:
33
+ name: Robust Speech Event - Dev Data
34
+ type: speech-recognition-community-v2/dev_data
35
+ args: sl
36
+ metrics:
37
+ - name: Test WER
38
+ type: wer
39
+ value: 45.587
40
+ - name: Test CER
41
+ type: cer
42
+ value: 20.886
43
  ---
44
 
45
  <!-- This model card has been generated automatically according to the information the Trainer had access to. You
 
103
  - Pytorch 1.10.2+cu102
104
  - Datasets 1.18.2.dev0
105
  - Tokenizers 0.11.0
106
+
107
+ #### Evaluation Commands
108
+ 1. To evaluate on `mozilla-foundation/common_voice_8_0` with split `test`
109
+
110
+ ```bash
111
+ python eval.py --model_id anuragshas/wav2vec2-xls-r-300m-sl-cv8-with-lm --dataset mozilla-foundation/common_voice_8_0 --config sl --split test
112
+ ```
113
+
114
+ 2. To evaluate on `speech-recognition-community-v2/dev_data`
115
+
116
+ ```bash
117
+ python eval.py --model_id anuragshas/wav2vec2-xls-r-300m-sl-cv8-with-lm --dataset speech-recognition-community-v2/dev_data --config sl --split validation --chunk_length_s 5.0 --stride_length_s 1.0
118
+ ```
119
+
120
+ ### Inference With LM
121
+
122
+ ```python
123
+ import torch
124
+ from datasets import load_dataset
125
+ from transformers import AutoModelForCTC, AutoProcessor
126
+ import torchaudio.functional as F
127
+ model_id = "anuragshas/wav2vec2-xls-r-300m-sl-cv8-with-lm"
128
+ sample_iter = iter(load_dataset("mozilla-foundation/common_voice_8_0", "sl", split="test", streaming=True, use_auth_token=True))
129
+ sample = next(sample_iter)
130
+ resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), 48_000, 16_000).numpy()
131
+ model = AutoModelForCTC.from_pretrained(model_id)
132
+ processor = AutoProcessor.from_pretrained(model_id)
133
+ input_values = processor(resampled_audio, return_tensors="pt").input_values
134
+ with torch.no_grad():
135
+ logits = model(input_values).logits
136
+ transcription = processor.batch_decode(logits.numpy()).text
137
+ # => "zmago je divje od letel s helikopterjem visoko vzrak"
138
+ ```
139
+
140
+ ### Eval results on Common Voice 8 "test" (WER):
141
+
142
+ | Without LM | With LM (run `./eval.py`) |
143
+ |---|---|
144
+ | 19.938 | 12.736 |