kingabzpro
commited on
Commit
·
99485d2
1
Parent(s):
d092371
Update README.md
Browse files
README.md
CHANGED
@@ -1,12 +1,57 @@
|
|
1 |
---
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
tags:
|
4 |
-
-
|
|
|
5 |
datasets:
|
6 |
-
-
|
|
|
|
|
|
|
7 |
model-index:
|
8 |
- name: wav2vec2-large-xls-r-1b-Swedish
|
9 |
-
results:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
---
|
11 |
|
12 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
@@ -16,23 +61,48 @@ should probably proofread and complete it, then remove this comment. -->
|
|
16 |
|
17 |
This model is a fine-tuned version of [facebook/wav2vec2-xls-r-1b](https://huggingface.co/facebook/wav2vec2-xls-r-1b) on the common_voice dataset.
|
18 |
It achieves the following results on the evaluation set:
|
19 |
-
- Loss: 0.3232
|
20 |
-
- Wer: 0.1844
|
21 |
-
- Cer: 0.0575
|
22 |
-
|
23 |
-
## Model description
|
24 |
-
|
25 |
-
More information needed
|
26 |
-
|
27 |
-
## Intended uses & limitations
|
28 |
-
|
29 |
-
More information needed
|
30 |
-
|
31 |
-
## Training and evaluation data
|
32 |
-
|
33 |
-
More information needed
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
### Training hyperparameters
|
38 |
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- sv-SE
|
4 |
+
|
5 |
license: apache-2.0
|
6 |
tags:
|
7 |
+
- automatic-speech-recognition
|
8 |
+
- robust-speech-event
|
9 |
datasets:
|
10 |
+
- mozilla-foundation/common_voice_8_0
|
11 |
+
metrics:
|
12 |
+
- wer
|
13 |
+
- cer
|
14 |
model-index:
|
15 |
- name: wav2vec2-large-xls-r-1b-Swedish
|
16 |
+
results:
|
17 |
+
- task:
|
18 |
+
type: automatic-speech-recognition # Required. Example: automatic-speech-recognition
|
19 |
+
name: Speech Recognition # Optional. Example: Speech Recognition
|
20 |
+
dataset:
|
21 |
+
type: mozilla-foundation/common_voice_8_0 # Required. Example: common_voice. Use dataset id from https://hf.co/datasets
|
22 |
+
name: Common Voice sv-SE # Required. Example: Common Voice zh-CN
|
23 |
+
args: sv-SE # Optional. Example: zh-CN
|
24 |
+
metrics:
|
25 |
+
- type: wer # Required. Example: wer
|
26 |
+
value: 14.04 # Required. Example: 20.90
|
27 |
+
name: Test WER Without LM # Optional. Example: Test WER
|
28 |
+
args:
|
29 |
+
- learning_rate: 7.5e-05
|
30 |
+
- train_batch_size: 32
|
31 |
+
- eval_batch_size: 8
|
32 |
+
- seed: 42
|
33 |
+
- gradient_accumulation_steps: 4
|
34 |
+
- total_train_batch_size: 128
|
35 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
36 |
+
- lr_scheduler_type: linear
|
37 |
+
- lr_scheduler_warmup_steps: 1000
|
38 |
+
- num_epochs: 50
|
39 |
+
- mixed_precision_training: Native AMP # Optional. Example for BLEU: max_order
|
40 |
+
- type: cer # Required. Example: wer
|
41 |
+
value: 4.86 # Required. Example: 20.90
|
42 |
+
name: Test CER Without LM # Optional. Example: Test WER
|
43 |
+
args:
|
44 |
+
- learning_rate: 7.5e-05
|
45 |
+
- train_batch_size: 32
|
46 |
+
- eval_batch_size: 8
|
47 |
+
- seed: 42
|
48 |
+
- gradient_accumulation_steps: 4
|
49 |
+
- total_train_batch_size: 128
|
50 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
51 |
+
- lr_scheduler_type: linear
|
52 |
+
- lr_scheduler_warmup_steps: 1000
|
53 |
+
- num_epochs: 50
|
54 |
+
- mixed_precision_training: Native AMP
|
55 |
---
|
56 |
|
57 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
|
|
61 |
|
62 |
This model is a fine-tuned version of [facebook/wav2vec2-xls-r-1b](https://huggingface.co/facebook/wav2vec2-xls-r-1b) on the common_voice dataset.
|
63 |
It achieves the following results on the evaluation set:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
**Without LM**
|
66 |
+
- Loss: 0.3370
|
67 |
+
- Wer: 18.44
|
68 |
+
- Cer: 5.75
|
69 |
+
|
70 |
+
**With LM**
|
71 |
+
- Loss: 0.3370
|
72 |
+
- Wer: 14.04
|
73 |
+
- Cer: 4.86
|
74 |
+
|
75 |
+
#### Evaluation Commands
|
76 |
+
1. To evaluate on `mozilla-foundation/common_voice_8_0` with split `test`
|
77 |
+
|
78 |
+
```bash
|
79 |
+
python eval.py --model_id kingabzpro/wav2vec2-large-xls-r-1b-Swedish --dataset mozilla-foundation/common_voice_8_0 --config sv-SE --split test
|
80 |
+
```
|
81 |
+
|
82 |
+
2. To evaluate on `speech-recognition-community-v2/dev_data`
|
83 |
+
|
84 |
+
```bash
|
85 |
+
python eval.py --model_id kingabzpro/wav2vec2-large-xls-r-1b-Swedish --dataset speech-recognition-community-v2/dev_data --config sv --split validation --chunk_length_s 5.0 --stride_length_s 1.0
|
86 |
+
```
|
87 |
+
|
88 |
+
### Inference With LM
|
89 |
+
|
90 |
+
```python
|
91 |
+
import torch
|
92 |
+
from datasets import load_dataset
|
93 |
+
from transformers import AutoModelForCTC, AutoProcessor
|
94 |
+
import torchaudio.functional as F
|
95 |
+
model_id = "kingabzpro/wav2vec2-large-xls-r-1b-Swedish"
|
96 |
+
sample_iter = iter(load_dataset("mozilla-foundation/common_voice_8_0", "sv-SE", split="test", streaming=True, use_auth_token=True))
|
97 |
+
sample = next(sample_iter)
|
98 |
+
resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), 48_000, 16_000).numpy()
|
99 |
+
model = AutoModelForCTC.from_pretrained(model_id)
|
100 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
101 |
+
input_values = processor(resampled_audio, return_tensors="pt").input_values
|
102 |
+
with torch.no_grad():
|
103 |
+
logits = model(input_values).logits
|
104 |
+
transcription = processor.batch_decode(logits.numpy()).text
|
105 |
+
```
|
106 |
|
107 |
### Training hyperparameters
|
108 |
|