Automatic Speech Recognition
Transformers
Safetensors
Welsh
English
wav2vec2
speech
Inference Endpoints
File size: 1,527 Bytes
a7cee1f
ff549fc
 
 
495b32e
ff549fc
 
495b32e
 
 
 
 
a7cee1f
ff549fc
a7cee1f
495b32e
ff549fc
495b32e
ff549fc
 
 
 
 
495b32e
 
 
ff549fc
495b32e
 
 
 
 
 
 
 
ff549fc
 
495b32e
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
---
language:
- cy
- en
datasets:
- techiaith/banc-trawsgrifiadau-bangor
- techiaith/commonvoice_16_1_en_cy
metrics:
- wer
tags:
- automatic-speech-recognition
- speech
license: apache-2.0
pipeline_tag: automatic-speech-recognition
---

# wav2vec2-xlsr-ft-cy-en

An acoustic encoder model for Welsh and English speech recognition, fine-tuned from 
[facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) using transcribed
spontaneous speech from 
[techiaith/banc-trawsgrifiadau-bangor (v24.01)](https://huggingface.co/datasets/techiaith/banc-trawsgrifiadau-bangor/tree/24.01)
as well as Welsh and English speech data derived from version 16.1 the Common Voice datasets [techiaith/commonvoice_16_1_en_cy](https://huggingface.co/datasets/techiaith/commonvoice_16_1_en_cy)

## Usage

The wav2vec2-xlsr-ft-cy-en model can be used directly as follows:

```python
import torch
import torchaudio
import librosa

from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor

processor = Wav2Vec2Processor.from_pretrained("techiaith/wav2vec2-xlsr-ft-cy-en")
model = Wav2Vec2ForCTC.from_pretrained("techiaith/wav2vec2-xlsr-ft-cy-en")

audio, rate = librosa.load(audio_file, sr=16000)

inputs = processor(audio, sampling_rate=16_000, return_tensors="pt", padding=True)

with torch.no_grad():
  tlogits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits

# greedy decoding
predicted_ids = torch.argmax(logits, dim=-1)

print("Prediction:", processor.batch_decode(predicted_ids))

```