aapot commited on
Commit
72cda06
1 Parent(s): fa36297

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +158 -15
README.md CHANGED
@@ -1,49 +1,124 @@
1
  ---
2
- license: cc-by-nc-4.0
 
 
 
 
3
  tags:
 
 
 
4
  - generated_from_trainer
 
 
 
5
  model-index:
6
  - name: wav2vec2-large-uralic-voxpopuli-v2-finnish
7
- results: []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ---
9
 
10
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
11
- should probably proofread and complete it, then remove this comment. -->
12
 
13
- # wav2vec2-large-uralic-voxpopuli-v2-finnish
 
14
 
15
- This model is a fine-tuned version of [facebook/wav2vec2-large-uralic-voxpopuli-v2](https://huggingface.co/facebook/wav2vec2-large-uralic-voxpopuli-v2) on the None dataset.
16
- It achieves the following results on the evaluation set:
17
- - Loss: 0.0828
18
- - Wer: 0.1075
19
 
20
  ## Model description
21
 
22
- More information needed
 
 
23
 
24
  ## Intended uses & limitations
25
 
26
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- ## Training and evaluation data
 
 
 
 
 
 
 
29
 
30
- More information needed
31
 
32
  ## Training procedure
33
 
 
 
 
 
 
 
34
  ### Training hyperparameters
35
 
36
  The following hyperparameters were used during training:
37
- - learning_rate: 0.0001
38
  - train_batch_size: 32
39
  - eval_batch_size: 32
40
  - seed: 42
41
- - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
42
  - lr_scheduler_type: linear
43
  - lr_scheduler_warmup_steps: 500
44
  - num_epochs: 10
45
  - mixed_precision_training: Native AMP
46
 
 
 
 
 
 
 
 
 
 
47
  ### Training results
48
 
49
  | Training Loss | Epoch | Step | Validation Loss | Wer |
@@ -116,3 +191,71 @@ The following hyperparameters were used during training:
116
  - Pytorch 1.11.0+cu102
117
  - Datasets 2.2.2
118
  - Tokenizers 0.11.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: apache-2.0
3
+ language: fi
4
+ metrics:
5
+ - wer
6
+ - cer
7
  tags:
8
+ - automatic-speech-recognition
9
+ - fi
10
+ - finnish
11
  - generated_from_trainer
12
+ - hf-asr-leaderboard
13
+ datasets:
14
+ - mozilla-foundation/common_voice_9_0
15
  model-index:
16
  - name: wav2vec2-large-uralic-voxpopuli-v2-finnish
17
+ results:
18
+ - task:
19
+ name: Automatic Speech Recognition
20
+ type: automatic-speech-recognition
21
+ dataset:
22
+ name: Common Voice 9
23
+ type: mozilla-foundation/common_voice_9_0
24
+ args: fi
25
+ metrics:
26
+ - name: Test WER
27
+ type: wer
28
+ value: 4.13
29
+ - name: Test CER
30
+ type: cer
31
+ value: 0.92
32
+ - task:
33
+ name: Automatic Speech Recognition
34
+ type: automatic-speech-recognition
35
+ dataset:
36
+ name: FLEURS ASR
37
+ type: google/fleurs
38
+ args: fi_fi
39
+ metrics:
40
+ - name: Test WER
41
+ type: wer
42
+ value: 12.44
43
+ - name: Test CER
44
+ type: cer
45
+ value: 5.77
46
  ---
47
 
48
+ # Wav2vec2-large-uralic-voxpopuli-v2 for Finnish ASR
 
49
 
50
+ This acoustic model is a fine-tuned version of [facebook/wav2vec2-large-uralic-voxpopuli-v2](https://huggingface.co/facebook/wav2vec2-large-uralic-voxpopuli-v2) for Finnish ASR. The model has been fine-tuned with 276.7 hours of Finnish transcribed speech data. Wav2Vec2 was introduced in
51
+ [this paper](https://arxiv.org/abs/2006.11477) and first released at [this page](https://github.com/pytorch/fairseq/tree/main/examples/wav2vec#wav2vec-20).
52
 
53
+ This repository also includes Finnish KenLM language model used in the decoding phase with the acoustic model.
 
 
 
54
 
55
  ## Model description
56
 
57
+ [Wav2vec2-large-uralic-voxpopuli-v2](https://huggingface.co/facebook/wav2vec2-large-uralic-voxpopuli-v2) is Facebook AI's pretrained model for uralic language family (Finnish, Estonian, Hungarian) speech. It is pretrained on 42.5k hours of unlabeled Finnish, Estonian and Hungarian speech from [VoxPopuli V2 dataset](https://github.com/facebookresearch/voxpopuli/) with the wav2vec 2.0 objective.
58
+
59
+ This model is fine-tuned version of the pretrained model for Finnish ASR.
60
 
61
  ## Intended uses & limitations
62
 
63
+ You can use this model for Finnish ASR (speech-to-text) task.
64
+
65
+ ### How to use
66
+
67
+ Check the [run-finnish-asr-models.ipynb](https://huggingface.co/Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish/blob/main/run-finnish-asr-models.ipynb) notebook in this repository for an detailed example on how to use this model.
68
+
69
+ ### Limitations and bias
70
+
71
+ This model was fine-tuned with audio samples which maximum length was 20 seconds so this model most likely works the best for quite short audios of similar length. However, you can try this model with a lot longer audios too and see how it works. If you encounter out of memory errors with very long audio files you can use the audio chunking method introduced in [this blog post](https://huggingface.co/blog/asr-chunking).
72
+
73
+ A vast majority of the data used for fine-tuning was from the Finnish Parliament dataset so this model may not generalize so well to very different domains like common daily spoken Finnish with dialects etc. In addition, audios of the datasets tend to be adult male dominated so this model may not work as well for speeches of children and women, for example.
74
+
75
+ The Finnish KenLM language model used in the decoding phase has been trained with text data from the audio transcriptions and from a subset of Finnish Wikipedia. Thus, the decoder's language model may not generalize to very different language, for example to spoken daily language with dialects (because especially the Wikipedia contains mostly formal Finnish language). It may be beneficial to train your own KenLM language model for your domain language and use that in the decoding.
76
+
77
+ ## Training data
78
+
79
+ This model was fine-tuned with 276.7 hours of Finnish transcribed speech data from following datasets:
80
 
81
+ | Dataset | Hours | % of total hours |
82
+ |:------------------------------------------------------------------------------------------------------------------------------ |:--------:|:----------------:|
83
+ | [Common Voice 9.0 Finnish train + evaluation + other splits](https://huggingface.co/datasets/mozilla-foundation/common_voice_9_0) | 10.80 h | 3.90 % |
84
+ | [Finnish parliament session 2](https://b2share.eudat.eu/records/4df422d631544ce682d6af1d4714b2d4) | 0.24 h | 0.09 % |
85
+ | [VoxPopuli Finnish](https://github.com/facebookresearch/voxpopuli) | 21.97 h | 7.94 % |
86
+ | [CSS10 Finnish](https://github.com/kyubyong/css10) | 10.32 h | 3.73 % |
87
+ | [Aalto Finnish Parliament ASR Corpus](http://urn.fi/urn:nbn:fi:lb-2021051903) | 228.00 h | 82.40 % |
88
+ | [Finnish Broadcast Corpus](http://urn.fi/urn:nbn:fi:lb-2016042502) | 5.37 h | 1.94 % |
89
 
90
+ Datasets were filtered to include maximum length of 20 seconds long audio samples.
91
 
92
  ## Training procedure
93
 
94
+ This model was trained on a Tesla V100 GPU, sponsored by Hugging Face & OVHcloud.
95
+
96
+ Training script was provided by Hugging Face and it is available [here](https://github.com/huggingface/transformers/blob/main/examples/research_projects/robust-speech-event/run_speech_recognition_ctc_bnb.py). We only modified its data loading for our custom datasets.
97
+
98
+ For the KenLM language model training, we followed the [blog post tutorial](https://huggingface.co/blog/wav2vec2-with-ngram) provided by Hugging Face. Training data for the 5-gram KenLM were text transcriptions of the audio training data and 100k random samples of cleaned [Finnish Wikipedia](https://huggingface.co/datasets/wikipedia) (August 2021) dataset.
99
+
100
  ### Training hyperparameters
101
 
102
  The following hyperparameters were used during training:
103
+ - learning_rate: 1e-04
104
  - train_batch_size: 32
105
  - eval_batch_size: 32
106
  - seed: 42
107
+ - optimizer: [8-bit Adam](https://github.com/facebookresearch/bitsandbytes) with betas=(0.9,0.999) and epsilon=1e-08
108
  - lr_scheduler_type: linear
109
  - lr_scheduler_warmup_steps: 500
110
  - num_epochs: 10
111
  - mixed_precision_training: Native AMP
112
 
113
+ The pretrained `facebook/wav2vec2-large-uralic-voxpopuli-v2` model was initialized with following hyperparameters:
114
+ - attention_dropout: 0.094
115
+ - hidden_dropout: 0.047
116
+ - feat_proj_dropout: 0.04
117
+ - mask_time_prob: 0.082
118
+ - layerdrop: 0.041
119
+ - activation_dropout: 0.055
120
+ - ctc_loss_reduction: "mean"
121
+
122
  ### Training results
123
 
124
  | Training Loss | Epoch | Step | Validation Loss | Wer |
191
  - Pytorch 1.11.0+cu102
192
  - Datasets 2.2.2
193
  - Tokenizers 0.11.0
194
+
195
+ ## Evaluation results
196
+
197
+ Evaluation was done with the [Common Voice 7.0 Finnish test split](https://huggingface.co/datasets/mozilla-foundation/common_voice_7_0), [Common Voice 9.0 Finnish test split](https://huggingface.co/datasets/mozilla-foundation/common_voice_9_0) and with the [FLEURS ASR Finnish test split](https://huggingface.co/datasets/google/fleurs).
198
+
199
+ This model's training data includes the training splits of Common Voice 9.0 but most of our previous models include the Common Voice 7.0 so we ran tests for both Common Voice versions. Note: Common Voice doesn't seem to fully preserve the test split as fixed between the dataset versions so it is possible that some of the training examples of Common Voice 9.0 are in the test split of the Common Voice 7.0 and vice versa. Thus, Common Voice test result comparisons are not fully accurate between the models trained with different Common Voice versions but the comparison should still be meaningful enough.
200
+
201
+ ### Common Voice 7.0 testing
202
+
203
+ To evaluate this model, run the `eval.py` script in this repository:
204
+
205
+ ```bash
206
+ python3 eval.py --model_id Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish --dataset mozilla-foundation/common_voice_7_0 --config fi --split test
207
+ ```
208
+
209
+ This model (the second row of the table) achieves the following WER (Word Error Rate) and CER (Character Error Rate) results compared to our other models and their parameter counts:
210
+
211
+ | | Model parameters | WER (with LM) | WER (without LM) | CER (with LM) | CER (without LM) |
212
+ |-------------------------------------------------------|------------------|---------------|------------------|---------------|------------------|
213
+ |Finnish-NLP/wav2vec2-base-fi-voxpopuli-v2-finetuned | 95 million |5.85 |13.52 |1.35 |2.44 |
214
+ |Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish | 300 million |4.13 |**9.66** |0.90 |1.66 |
215
+ |Finnish-NLP/wav2vec2-xlsr-300m-finnish-lm | 300 million |8.16 |17.92 |1.97 |3.36 |
216
+ |Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm | 1000 million |5.65 |13.11 |1.20 |2.23 |
217
+ |Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm-v2 | 1000 million |**4.09** |9.73 |**0.88** |**1.65** |
218
+
219
+ ### Common Voice 9.0 testing
220
+
221
+ To evaluate this model, run the `eval.py` script in this repository:
222
+
223
+ ```bash
224
+ python3 eval.py --model_id Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish --dataset mozilla-foundation/common_voice_9_0 --config fi --split test
225
+ ```
226
+
227
+ This model (the second row of the table) achieves the following WER (Word Error Rate) and CER (Character Error Rate) results compared to our other models and their parameter counts:
228
+
229
+ | | Model parameters | WER (with LM) | WER (without LM) | CER (with LM) | CER (without LM) |
230
+ |-------------------------------------------------------|------------------|---------------|------------------|---------------|------------------|
231
+ |Finnish-NLP/wav2vec2-base-fi-voxpopuli-v2-finetuned | 95 million |5.93 |14.08 |1.40 |2.59 |
232
+ |Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish | 300 million |4.13 |9.83 |0.92 |1.71 |
233
+ |Finnish-NLP/wav2vec2-xlsr-300m-finnish-lm | 300 million |7.42 |16.45 |1.79 |3.07 |
234
+ |Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm | 1000 million |5.35 |13.00 |1.14 |2.20 |
235
+ |Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm-v2 | 1000 million |**3.72** |**8.96** |**0.80** |**1.52** |
236
+
237
+ ### FLEURS ASR testing
238
+
239
+ To evaluate this model, run the `eval.py` script in this repository:
240
+
241
+ ```bash
242
+ python3 eval.py --model_id Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish --dataset google/fleurs --config fi_fi --split test
243
+ ```
244
+
245
+ This model (the second row of the table) achieves the following WER (Word Error Rate) and CER (Character Error Rate) results compared to our other models and their parameter counts:
246
+
247
+ | | Model parameters | WER (with LM) | WER (without LM) | CER (with LM) | CER (without LM) |
248
+ |-------------------------------------------------------|------------------|---------------|------------------|---------------|------------------|
249
+ |Finnish-NLP/wav2vec2-base-fi-voxpopuli-v2-finetuned | 95 million |13.99 |17.16 |6.07 |6.61 |
250
+ |Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish | 300 million |12.44 |**14.63** |5.77 |6.22 |
251
+ |Finnish-NLP/wav2vec2-xlsr-300m-finnish-lm | 300 million |17.72 |23.30 |6.78 |7.67 |
252
+ |Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm | 1000 million |20.34 |16.67 |6.97 |6.35 |
253
+ |Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm-v2 | 1000 million |**12.11** |14.89 |**5.65** |**6.06** |
254
+
255
+
256
+ ## Team Members
257
+
258
+ - Aapo Tanskanen, [Hugging Face profile](https://huggingface.co/aapot), [LinkedIn profile](https://www.linkedin.com/in/aapotanskanen/)
259
+ - Rasmus Toivanen, [Hugging Face profile](https://huggingface.co/RASMUS), [LinkedIn profile](https://www.linkedin.com/in/rasmustoivanen/)
260
+
261
+ Feel free to contact us for more details 🤗