infinitejoy commited on
Commit
ef86c9e
1 Parent(s): e06a3c3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +148 -0
README.md ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ar
4
+ license: apache-2.0
5
+ tags:
6
+ - automatic-speech-recognition
7
+ - mozilla-foundation/common_voice_7_0
8
+ - generated_from_trainer
9
+ - ar
10
+ - robust-speech-event
11
+ - model_for_talk
12
+ datasets:
13
+ - mozilla-foundation/common_voice_7_0
14
+ model-index:
15
+ - name: XLS-R-300M - Arabic
16
+ results:
17
+ - task:
18
+ name: Automatic Speech Recognition
19
+ type: automatic-speech-recognition
20
+ dataset:
21
+ name: Common Voice 7
22
+ type: mozilla-foundation/common_voice_7_0
23
+ args: ar
24
+ metrics:
25
+ - name: Test WER
26
+ type: wer
27
+ value: NA
28
+ - name: Test CER
29
+ type: cer
30
+ value: NA
31
+ - task:
32
+ name: Automatic Speech Recognition
33
+ type: automatic-speech-recognition
34
+ dataset:
35
+ name: Robust Speech Event - Dev Data
36
+ type: speech-recognition-community-v2/dev_data
37
+ args: ar
38
+ metrics:
39
+ - name: Test WER
40
+ type: wer
41
+ value: NA
42
+ - name: Test CER
43
+ type: cer
44
+ value: NA
45
+ ---
46
+
47
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
48
+ should probably proofread and complete it, then remove this comment. -->
49
+
50
+ # XLS-R-300m-SV
51
+
52
+ This model is a fine-tuned version of [facebook/wav2vec2-xls-r-300m](https://huggingface.co/facebook/wav2vec2-xls-r-300m) on the MOZILLA-FOUNDATION/COMMON_VOICE_7_0 - AR dataset.
53
+ It achieves the following results on the evaluation set:
54
+ - Loss: NA
55
+ - Wer: NA
56
+
57
+ ## Model description
58
+
59
+ More information needed
60
+
61
+ ## Intended uses & limitations
62
+
63
+ More information needed
64
+
65
+ ## Training and evaluation data
66
+
67
+ More information needed
68
+
69
+ ## Training procedure
70
+
71
+ ### Training hyperparameters
72
+
73
+ The following hyperparameters were used during training:
74
+ - learning_rate: 7.5e-05
75
+ - train_batch_size: 8
76
+ - eval_batch_size: 8
77
+ - seed: 42
78
+ - gradient_accumulation_steps: 4
79
+ - total_train_batch_size: 32
80
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
81
+ - lr_scheduler_type: linear
82
+ - lr_scheduler_warmup_steps: 2000
83
+ - num_epochs: 50.0
84
+ - mixed_precision_training: Native AMP
85
+
86
+ ### Training results
87
+
88
+
89
+
90
+ ### Framework versions
91
+
92
+ - Transformers 4.16.0.dev0
93
+ - Pytorch 1.10.0+cu102
94
+ - Datasets 1.17.1.dev0
95
+ - Tokenizers 0.10.3
96
+
97
+ #### Evaluation Commands
98
+
99
+ 1. To evaluate on `mozilla-foundation/common_voice_7_0` with split `test`
100
+
101
+ ```bash
102
+ python eval.py \
103
+ --model_id infinitejoy/wav2vec2-large-xls-r-300m-arabic \
104
+ --dataset mozilla-foundation/common_voice_7_0 --config ar --split test --log_outputs
105
+ ```
106
+
107
+ 2. To evaluate on `speech-recognition-community-v2/dev_data`
108
+
109
+ ```bash
110
+ python eval.py \
111
+ --model_id infinitejoy/wav2vec2-large-xls-r-300m-arabic --dataset speech-recognition-community-v2/dev_data \
112
+ --config ar --split validation --chunk_length_s 10 --stride_length_s 1
113
+ ```
114
+
115
+ ### Inference With LM
116
+
117
+ ```python
118
+ import torch
119
+ from datasets import load_dataset
120
+ from transformers import AutoModelForCTC, AutoProcessor
121
+ import torchaudio.functional as F
122
+
123
+
124
+ model_id = "infinitejoy/wav2vec2-large-xls-r-300m-arabic"
125
+
126
+ sample_iter = iter(load_dataset("mozilla-foundation/common_voice_7_0", "ar", split="test", streaming=True, use_auth_token=True))
127
+
128
+ sample = next(sample_iter)
129
+ resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), 48_000, 16_000).numpy()
130
+
131
+ model = AutoModelForCTC.from_pretrained(model_id)
132
+ processor = AutoProcessor.from_pretrained(model_id)
133
+
134
+ input_values = processor(resampled_audio, return_tensors="pt").input_values
135
+
136
+ with torch.no_grad():
137
+ logits = model(input_values).logits
138
+
139
+ transcription = processor.batch_decode(logits.numpy()).text
140
+
141
+ ```
142
+
143
+ ### Eval results on Common Voice 7 "test" (WER):
144
+
145
+ | Without LM | With LM (run `./eval.py`) |
146
+ |---|---|
147
+ | NA | NA |
148
+