infinitejoy
commited on
Commit
•
b20b68a
1
Parent(s):
26682d6
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- ur
|
4 |
+
license: apache-2.0
|
5 |
+
tags:
|
6 |
+
- automatic-speech-recognition
|
7 |
+
- mozilla-foundation/common_voice_7_0
|
8 |
+
- generated_from_trainer
|
9 |
+
- ur
|
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 - Urdu
|
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: ur
|
24 |
+
metrics:
|
25 |
+
- name: Test WER
|
26 |
+
type: wer
|
27 |
+
value: 105.66
|
28 |
+
- name: Test CER
|
29 |
+
type: cer
|
30 |
+
value: 434.011
|
31 |
+
---
|
32 |
+
|
33 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
34 |
+
should probably proofread and complete it, then remove this comment. -->
|
35 |
+
|
36 |
+
infinitejoy/wav2vec2-large-xls-r-300m-urdu
|
37 |
+
|
38 |
+
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 - -UR dataset.
|
39 |
+
It achieves the following results on the evaluation set:
|
40 |
+
- Loss: NA
|
41 |
+
- Wer: NA
|
42 |
+
|
43 |
+
## Model description
|
44 |
+
|
45 |
+
More information needed
|
46 |
+
|
47 |
+
## Intended uses & limitations
|
48 |
+
|
49 |
+
More information needed
|
50 |
+
|
51 |
+
## Training and evaluation data
|
52 |
+
|
53 |
+
More information needed
|
54 |
+
|
55 |
+
## Training procedure
|
56 |
+
|
57 |
+
### Training hyperparameters
|
58 |
+
|
59 |
+
The following hyperparameters were used during training:
|
60 |
+
- learning_rate: 7.5e-05
|
61 |
+
- train_batch_size: 8
|
62 |
+
- eval_batch_size: 8
|
63 |
+
- seed: 42
|
64 |
+
- gradient_accumulation_steps: 4
|
65 |
+
- total_train_batch_size: 32
|
66 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
67 |
+
- lr_scheduler_type: linear
|
68 |
+
- lr_scheduler_warmup_steps: 2000
|
69 |
+
- num_epochs: 50.0
|
70 |
+
- mixed_precision_training: Native AMP
|
71 |
+
|
72 |
+
### Training results
|
73 |
+
|
74 |
+
|
75 |
+
### Framework versions
|
76 |
+
|
77 |
+
- Transformers 4.16.0.dev0
|
78 |
+
- Pytorch 1.10.0+cu102
|
79 |
+
- Datasets 1.17.1.dev0
|
80 |
+
- Tokenizers 0.10.3
|
81 |
+
|
82 |
+
#### Evaluation Commands
|
83 |
+
|
84 |
+
1. To evaluate on `mozilla-foundation/common_voice_7_0` with split `test`
|
85 |
+
|
86 |
+
```bash
|
87 |
+
python eval.py \
|
88 |
+
--model_id infinitejoy/wav2vec2-large-xls-r-300m-urdu --dataset speech-recognition-community-v2/dev_data \
|
89 |
+
--config ur --split validation --chunk_length_s 10 --stride_length_s 1
|
90 |
+
```
|
91 |
+
|
92 |
+
### Inference
|
93 |
+
|
94 |
+
```python
|
95 |
+
import torch
|
96 |
+
from datasets import load_dataset
|
97 |
+
from transformers import AutoModelForCTC, AutoProcessor
|
98 |
+
import torchaudio.functional as F
|
99 |
+
|
100 |
+
|
101 |
+
model_id = "infinitejoy/wav2vec2-large-xls-r-300m-urdu"
|
102 |
+
|
103 |
+
sample_iter = iter(load_dataset("mozilla-foundation/common_voice_7_0", "ur", split="test", streaming=True, use_auth_token=True))
|
104 |
+
|
105 |
+
sample = next(sample_iter)
|
106 |
+
resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), 48_000, 16_000).numpy()
|
107 |
+
|
108 |
+
model = AutoModelForCTC.from_pretrained(model_id)
|
109 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
110 |
+
|
111 |
+
input_values = processor(resampled_audio, return_tensors="pt").input_values
|
112 |
+
|
113 |
+
with torch.no_grad():
|
114 |
+
logits = model(input_values).logits
|
115 |
+
|
116 |
+
transcription = processor.batch_decode(logits.numpy()).text
|
117 |
+
```
|
118 |
+
|
119 |
+
### Eval results on Common Voice 7 "test" (WER):
|
120 |
+
|