File size: 2,013 Bytes
820d04f f2bdd30 8aaa6d9 f2bdd30 820d04f f48d0ef 820d04f f48d0ef 820d04f f48d0ef f2bdd30 f48d0ef f2bdd30 f48d0ef f2bdd30 f48d0ef f2bdd30 f48d0ef f2bdd30 f48d0ef f2bdd30 f48d0ef f2bdd30 f48d0ef f2bdd30 |
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 53 54 55 56 57 58 59 60 61 62 63 |
---
license: apache-2.0
base_model: facebook/wav2vec2-large-xlsr-53
metrics:
- wer
datasets:
- techiaith/commonvoice_16_1_en_cy
- techiaith/banc-trawsgrifiadau-bangor
language:
- cy
- en
pipeline_tag: automatic-speech-recognition
---
# wav2vec2-xlsr-53-ft-cy-en-withlm
This model is a version of [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53)
that has been fined-tuned with a custom bilingual datasets derived from the Welsh
and English data releases of Mozilla Foundation's Commonvoice project. See : [techiaith/commonvoice_16_1_en_cy](https://huggingface.co/datasets/techiaith/commonvoice_16_1_en_cy).
In addition, this model also includes a single KenLM n-gram model trained with balanced
collections of Welsh and English texts from [OSCAR](https://huggingface.co/datasets/oscar)
This avoids the need for any language detection for determining whether to use a Welsh or English n-gram models during CTC decoding.
## Usage
The `wav2vec2-xlsr-53-ft-cy-en-withlm` model can be used directly as follows:
```python
import torch
import torchaudio
import librosa
from transformers import Wav2Vec2ForCTC, Wav2Vec2ProcessorWithLM
processor = Wav2Vec2ProcessorWithLM.from_pretrained("techiaith/wav2vec2-xlsr-53-ft-cy-en-withlm")
model = Wav2Vec2ForCTC.from_pretrained("techiaith/wav2vec2-xlsr-53-ft-cy-en-withlm")
audio, rate = librosa.load(<path/to/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
print("Prediction: ", processor.batch_decode(tlogits.numpy(), beam_width=10).text[0].strip())
```
Usage with a pipeline is even simpler...
```
from transformers import pipeline
transcriber = pipeline("automatic-speech-recognition", model="techiaith/wav2vec2-xlsr-53-ft-cy-en-withlm")
def transcribe(audio):
return transcriber(audio)["text"]
transcribe(<path/or/url/to/any/audiofile>)
```
|