Update README.md
Browse files
README.md
CHANGED
@@ -1,49 +1,110 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
3 |
tags:
|
|
|
|
|
|
|
4 |
- generated_from_trainer
|
|
|
|
|
|
|
5 |
model-index:
|
6 |
- name: wav2vec2-base-fi-voxpopuli-v2-finetuned
|
7 |
-
results:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
|
11 |
-
should probably proofread and complete it, then remove this comment. -->
|
12 |
|
13 |
-
|
|
|
14 |
|
15 |
-
This
|
16 |
-
It achieves the following results on the evaluation set:
|
17 |
-
- Loss: 0.1316
|
18 |
-
- Wer: 0.1498
|
19 |
|
20 |
## Model description
|
21 |
|
22 |
-
|
|
|
|
|
23 |
|
24 |
## Intended uses & limitations
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
## Training procedure
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
### Training hyperparameters
|
35 |
|
36 |
The following hyperparameters were used during training:
|
37 |
-
- learning_rate:
|
38 |
- train_batch_size: 64
|
39 |
- eval_batch_size: 64
|
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 |
|
@@ -86,3 +147,49 @@ The following hyperparameters were used during training:
|
|
86 |
- Pytorch 1.11.0+cu102
|
87 |
- Datasets 2.2.1
|
88 |
- 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-base-fi-voxpopuli-v2-finetuned
|
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: 5.93
|
29 |
+
- name: Test CER
|
30 |
+
type: cer
|
31 |
+
value: 1.40
|
32 |
---
|
33 |
|
34 |
+
# Wav2Vec2-base-fi-voxpopuli-v2 for Finnish ASR
|
|
|
35 |
|
36 |
+
This acoustic model is a fine-tuned version of [facebook/wav2vec2-base-fi-voxpopuli-v2](https://huggingface.co/facebook/wav2vec2-base-fi-voxpopuli-v2) for Finnish ASR. The model has been fine-tuned with 276.7 hours of Finnish transcribed speech data. Wav2Vec2 was introduced in
|
37 |
+
[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).
|
38 |
|
39 |
+
This repository also includes Finnish KenLM language model used in the decoding phase with the acoustic model.
|
|
|
|
|
|
|
40 |
|
41 |
## Model description
|
42 |
|
43 |
+
[Wav2vec2-base-fi-voxpopuli-v2](https://huggingface.co/facebook/wav2vec2-base-fi-voxpopuli-v2) is Facebook AI's pretrained model for Finnish speech. It is pretrained on 14.2k hours of unlabeled Finnish speech from [VoxPopuli V2 dataset](https://github.com/facebookresearch/voxpopuli/) with the wav2vec 2.0 objective.
|
44 |
+
|
45 |
+
This model is fine-tuned version of the pretrained model for Finnish ASR.
|
46 |
|
47 |
## Intended uses & limitations
|
48 |
|
49 |
+
You can use this model for Finnish ASR (speech-to-text) task.
|
50 |
+
|
51 |
+
### How to use
|
52 |
+
|
53 |
+
Check the [run-finnish-asr-models.ipynb](https://huggingface.co/Finnish-NLP/wav2vec2-base-fi-voxpopuli-v2-finetuned/blob/main/run-finnish-asr-models.ipynb) notebook in this repository for an detailed example on how to use this model.
|
54 |
+
|
55 |
+
### Limitations and bias
|
56 |
+
|
57 |
+
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).
|
58 |
+
|
59 |
+
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.
|
60 |
+
|
61 |
+
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.
|
62 |
+
|
63 |
+
## Training data
|
64 |
|
65 |
+
This model was fine-tuned with 276.7 hours of Finnish transcribed speech data from following datasets:
|
66 |
|
67 |
+
| Dataset | Hours | % of total hours |
|
68 |
+
|:------------------------------------------------------------------------------------------------------------------------------ |:--------:|:----------------:|
|
69 |
+
| [Common Voice 9.0 Finnish train + evaluation + other splits](https://huggingface.co/datasets/mozilla-foundation/common_voice_9_0) | 10.80 h | 3.90 % |
|
70 |
+
| [Finnish parliament session 2](https://b2share.eudat.eu/records/4df422d631544ce682d6af1d4714b2d4) | 0.24 h | 0.09 % |
|
71 |
+
| [VoxPopuli Finnish](https://github.com/facebookresearch/voxpopuli) | 21.97 h | 7.94 % |
|
72 |
+
| [CSS10 Finnish](https://github.com/kyubyong/css10) | 10.32 h | 3.73 % |
|
73 |
+
| [Aalto Finnish Parliament ASR Corpus](http://urn.fi/urn:nbn:fi:lb-2021051903) | 228.00 h | 82.40 % |
|
74 |
+
| [Finnish Broadcast Corpus](http://urn.fi/urn:nbn:fi:lb-2016042502) | 5.37 h | 1.94 % |
|
75 |
+
|
76 |
+
Datasets were filtered to include maximum length of 20 seconds long audio samples.
|
77 |
|
78 |
## Training procedure
|
79 |
|
80 |
+
This model was trained on a Tesla V100 GPU, sponsored by Hugging Face & OVHcloud.
|
81 |
+
|
82 |
+
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.
|
83 |
+
|
84 |
+
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.
|
85 |
+
|
86 |
### Training hyperparameters
|
87 |
|
88 |
The following hyperparameters were used during training:
|
89 |
+
- learning_rate: 1e-04
|
90 |
- train_batch_size: 64
|
91 |
- eval_batch_size: 64
|
92 |
- seed: 42
|
93 |
+
- optimizer: [8-bit Adam](https://github.com/facebookresearch/bitsandbytes) with betas=(0.9,0.999) and epsilon=1e-08
|
94 |
- lr_scheduler_type: linear
|
95 |
- lr_scheduler_warmup_steps: 500
|
96 |
- num_epochs: 10
|
97 |
- mixed_precision_training: Native AMP
|
98 |
|
99 |
+
The pretrained `facebook/wav2vec2-base-fi-voxpopuli-v2` model was initialized with following hyperparameters:
|
100 |
+
- attention_dropout: 0.094
|
101 |
+
- hidden_dropout: 0.047
|
102 |
+
- feat_proj_dropout: 0.04
|
103 |
+
- mask_time_prob: 0.082
|
104 |
+
- layerdrop: 0.041
|
105 |
+
- activation_dropout: 0.055
|
106 |
+
- ctc_loss_reduction: "mean"
|
107 |
+
|
108 |
### Training results
|
109 |
|
110 |
| Training Loss | Epoch | Step | Validation Loss | Wer |
|
|
|
147 |
- Pytorch 1.11.0+cu102
|
148 |
- Datasets 2.2.1
|
149 |
- Tokenizers 0.11.0
|
150 |
+
|
151 |
+
## Evaluation results
|
152 |
+
|
153 |
+
Evaluation was done with the [Common Voice 7.0 Finnish test split](https://huggingface.co/datasets/mozilla-foundation/common_voice_7_0) and with the [Common Voice 9.0 Finnish test split](https://huggingface.co/datasets/mozilla-foundation/common_voice_9_0). This model's training data includes the training splits of Common Voice 9.0 but our previous models include the Common Voice 7.0 so we ran tests for both 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, test result comparisons are not fully accurate between the models trained with different Common Voice versions but the comparison should still be meaningful enough.
|
154 |
+
|
155 |
+
### Common Voice 7.0 testing
|
156 |
+
|
157 |
+
To evaluate this model, run the `eval.py` script in this repository:
|
158 |
+
|
159 |
+
```bash
|
160 |
+
python3 eval.py --model_id Finnish-NLP/wav2vec2-base-fi-voxpopuli-v2-finetuned --dataset mozilla-foundation/common_voice_7_0 --config fi --split test
|
161 |
+
```
|
162 |
+
|
163 |
+
This model (the third 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:
|
164 |
+
|
165 |
+
| | Model parameters | WER (with LM) | WER (without LM) | CER (with LM) | CER (without LM) |
|
166 |
+
|----------------------------------------------------|------------------|---------------|------------------|---------------|------------------|
|
167 |
+
|Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm-v2 | 1000 million |**4.09** |**9.73** |**0.88** |**1.65** |
|
168 |
+
|Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm | 1000 million |5.65 |13.11 |1.20 |2.23 |
|
169 |
+
|Finnish-NLP/wav2vec2-base-fi-voxpopuli-v2-finetuned | 95 million |5.85 |13.52 |1.35 |2.44 |
|
170 |
+
|Finnish-NLP/wav2vec2-xlsr-300m-finnish-lm | 300 million |8.16 |17.92 |1.97 |3.36 |
|
171 |
+
|
172 |
+
### Common Voice 9.0 testing
|
173 |
+
|
174 |
+
To evaluate this model, run the `eval.py` script in this repository:
|
175 |
+
|
176 |
+
```bash
|
177 |
+
python3 eval.py --model_id Finnish-NLP/wav2vec2-base-fi-voxpopuli-v2-finetuned --dataset mozilla-foundation/common_voice_9_0 --config fi --split test
|
178 |
+
```
|
179 |
+
|
180 |
+
This model (the third 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:
|
181 |
+
|
182 |
+
| | Model parameters | WER (with LM) | WER (without LM) | CER (with LM) | CER (without LM) |
|
183 |
+
|----------------------------------------------------|------------------|---------------|------------------|---------------|------------------|
|
184 |
+
|Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm-v2 | 1000 million |**3.72** |**8.96** |**0.80** |**1.52** |
|
185 |
+
|Finnish-NLP/wav2vec2-xlsr-1b-finnish-lm | 1000 million |5.35 |13.00 |1.14 |2.20 |
|
186 |
+
|Finnish-NLP/wav2vec2-base-fi-voxpopuli-v2-finetuned | 95 million |5.93 |14.08 |1.40 |2.59 |
|
187 |
+
|Finnish-NLP/wav2vec2-xlsr-300m-finnish-lm | 300 million |7.42 |16.45 |1.79 |3.07 |
|
188 |
+
|
189 |
+
|
190 |
+
## Team Members
|
191 |
+
|
192 |
+
- Aapo Tanskanen, [Hugging Face profile](https://huggingface.co/aapot), [LinkedIn profile](https://www.linkedin.com/in/aapotanskanen/)
|
193 |
+
- Rasmus Toivanen, [Hugging Face profile](https://huggingface.co/RASMUS), [LinkedIn profile](https://www.linkedin.com/in/rasmustoivanen/)
|
194 |
+
|
195 |
+
Feel free to contact us for more details 🤗
|