Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- automatic-speech-recognition
|
5 |
+
- sami
|
6 |
+
model-index:
|
7 |
+
- name: wav2vec2-xls-r-300m-sami-parl-ext-ft
|
8 |
+
results:
|
9 |
+
- task:
|
10 |
+
name: Automatic Speech Recognition
|
11 |
+
type: automatic-speech-recognition
|
12 |
+
dataset:
|
13 |
+
name: UIT-SME
|
14 |
+
type: uit-sme
|
15 |
+
args: sami
|
16 |
+
metrics:
|
17 |
+
- name: WER
|
18 |
+
type: wer
|
19 |
+
value: 28.84
|
20 |
+
- name: CER
|
21 |
+
type: cer
|
22 |
+
value: 7.36
|
23 |
+
---
|
24 |
+
# Northern Sámi Wav2vec2-Large ASR
|
25 |
+
|
26 |
+
[facebook/wav2vec2-xls-r-300m](https://huggingface.co/facebook/wav2vec2-xls-r-300m) with two-step, extended fine-tuning. The model was originally adapted to Finnish ASR with 1500 hours of speech from the [Lahjoita puhetta (Donate Speech) corpus](https://link.springer.com/article/10.1007/s10579-022-09606-3), followed by adding randomly initialized weights and bias terms in the final linear layer (language modeling head) for the 12 new characters introduced by the target Sámi data and fine-tuning on 20 hours of [Sámi Parliament speech data](https://sametinget.kommunetv.no/archive) on 16kHz sampled speech audio. When using the model make sure that your speech input is also sampled at 16Khz.
|
27 |
+
|
28 |
+
## Model description
|
29 |
+
|
30 |
+
The Sámi Wav2Vec2 Large has the same architecture and uses the same training objective as the English and multilingual one described in [Paper](https://arxiv.org/abs/2006.11477).
|
31 |
+
|
32 |
+
You can read more about the pre-trained model from [this paper](TODO). The training scripts are available on [GitHub](https://github.com/aalto-speech/northern-sami-asr)
|
33 |
+
|
34 |
+
## Intended uses & limitations
|
35 |
+
|
36 |
+
You can use this model for Sámi ASR (speech-to-text).
|
37 |
+
|
38 |
+
### How to use
|
39 |
+
|
40 |
+
To transcribe audio files the model can be used as a standalone acoustic model as follows:
|
41 |
+
|
42 |
+
```
|
43 |
+
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
|
44 |
+
from datasets import load_dataset
|
45 |
+
import torch
|
46 |
+
|
47 |
+
# load model and processor
|
48 |
+
processor = Wav2Vec2Processor.from_pretrained("GetmanY1/wav2vec2-xls-r-300m-sami-parl-ext-ft")
|
49 |
+
model = Wav2Vec2ForCTC.from_pretrained("GetmanY1/wav2vec2-xls-r-300m-sami-parl-ext-ft")
|
50 |
+
|
51 |
+
# load dummy dataset and read soundfiles
|
52 |
+
ds = load_dataset("mozilla-foundation/common_voice_16_1", "fi", split='test')
|
53 |
+
|
54 |
+
# tokenize
|
55 |
+
input_values = processor(ds[0]["audio"]["array"], return_tensors="pt", padding="longest").input_values # Batch size 1
|
56 |
+
|
57 |
+
# retrieve logits
|
58 |
+
logits = model(input_values).logits
|
59 |
+
|
60 |
+
# take argmax and decode
|
61 |
+
predicted_ids = torch.argmax(logits, dim=-1)
|
62 |
+
transcription = processor.batch_decode(predicted_ids)
|
63 |
+
```
|
64 |
+
|
65 |
+
### Limitations and bias
|
66 |
+
|
67 |
+
This model was fine-tuned with audio samples whose maximum length was 30 seconds so this model most likely works the best for 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).
|
68 |
+
|
69 |
+
The model was fine-tuned on the data from the [Sámi Parliament speech data](https://sametinget.kommunetv.no/archive) so this model might have biases towards formal Sámi.
|
70 |
+
|
71 |
+
## Citation
|
72 |
+
|
73 |
+
If you use our models or scripts, please cite our article as:
|
74 |
+
|
75 |
+
```bibtex
|
76 |
+
@inproceedings{getman24b_interspeech,
|
77 |
+
author={Yaroslav Getman and Tamas Grosz and Katri Hiovain-Asikainen and Mikko Kurimo},
|
78 |
+
title={{Exploring adaptation techniques of large speech foundation models for low-resource ASR: a case study on Northern Sámi}},
|
79 |
+
year=2024,
|
80 |
+
booktitle={Proc. INTERSPEECH 2024},
|
81 |
+
pages={XX--XX},
|
82 |
+
doi={XXXX},
|
83 |
+
issn={XXXX-XXXX}
|
84 |
+
}
|
85 |
+
```
|