File size: 1,062 Bytes
dd9561c
 
2f23015
 
 
 
 
 
dd9561c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60e858d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
license: cc-by-4.0
language:
- qu
metrics:
- cer
- wer
pipeline_tag: automatic-speech-recognition
---

## Usage

The model can be used directly (without a language model) as follows:

```python
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
import torch
import torchaudio

# load model and processor
processor = Wav2Vec2Processor.from_pretrained("ivangtorre/wav2vec2-xls-r-300m-quechua")
model = Wav2Vec2ForCTC.from_pretrained("ivangtorre/wav2vec2-xls-r-300m-quechua")

# load dummy dataset and read soundfiles
file = torchaudio.load("quechua000573.wav")

# retrieve logits
logits = model(file[0]).logits

# take argmax and decode
predicted_ids = torch.argmax(logits, dim=-1)
transcription = processor.batch_decode(predicted_ids)
print("HF prediction: ", transcription)
```

## Citation

```bibtex
@misc{grosman2021xlsr-1b-russian,
  title={Fine-tuned {XLS-R} 1{B} model for speech recognition in {R}ussian},
  author={Grosman, Jonatas},
  howpublished={\url{https://huggingface.co/jonatasgrosman/wav2vec2-xls-r-1b-russian}},
  year={2022}
}
```