Downloads · 30 days
353
0% of all-time downloads
techiaith/wav2vec2-xlsr-53-ft-cy-en
wav2vec2-xlsr-53-ft-cy-en is a automatic speech recognition model from techiaith. Use it when you need speech turned into text. It is set up for transformers. The card lists the license as apache-2.0.
A facebook/wav2vec2-large-xlsr-53 acoustic model fine-tuned with a character-level CTC head for Welsh speech recognition, with UK- and Irish-accented English as a secondary language, released with a KenLM n-gram decod…
Downloads · 30 days
353
0% of all-time downloads
All-time downloads
148K
Public
Parameters
315M
5.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.3 GB · 93%
From the Hugging Face model README
A facebook/wav2vec2-large-xlsr-53 acoustic model fine-tuned with a character-level CTC head for Welsh speech recognition, with UK- and Irish-accented English as a secondary language, released with a KenLM n-gram decoder. Developed by the Language Technologies Unit, Bangor University. Output is lowercase without punctuation.
A new model, trained from XLSR-53 on the Unit's 2607 data configuration. This is the first tagged release on this repository since 24.07 (July 2024). The Unit's wav2vec2 release in the meantime, wav2vec2-btb-cv-ft-cv-cy 24.10, went out under a separate name and is the comparison point in the tables below.
Wav2Vec2ProcessorWithLM.
On the benchmark it is worth 3.4 WER points over greedy decoding averaged across the
five test sets (between 2 and 4 points per set), less than n-gram decoders usually give wav2vec2
models; the table under the results shows both.LICENSE
and NOTICE files described under Licence. The model may be used commercially.WER / CER (lower is better) on the held-out test sets, scored per utterance against the same references for every model compared.
The references are the test sets' transcripts as published, with their capitalisation and punctuation intact; only transcription-convention markers (such as <chwerthin>) are removed before scoring. This model emits lowercase text without punctuation, so every reference word that carries a capital letter or attached punctuation is scored as an error. The figures are therefore conservative, and higher than a normalised comparison would give, but every model in the table is scored the same way, so the comparison between them holds.
Decoding. The WER and CER columns are for this model decoded with its KenLM 5-gram
decoder (revision 2607-20261021-kenlm), which is what the repository ships and what
Wav2Vec2ProcessorWithLM loads. The greedy, no LM column is the same acoustic model
decoded greedily (revision 2607-20261021). The 24.10 figures use that model's own KenLM
decoder, which its published repository carries, so the two models are compared like for
like.
Mean across the four Welsh test sets: WER 39.67, against 51.08 for 24.10: 11.41 points lower. Lower WER than 24.10 on every set.
| Test set | WER | CER | WER (greedy, no LM) | WER (24.10) |
|---|---|---|---|---|
cymen-arfor/lleisiau-arfor (spontaneous, mixed dialects) | 45.38 | 18.40 | 49.63 | 68.29 |
google/fleurs/cy-gb (read, FLEURS) | 42.42 | 15.28 | 46.32 | 43.41 |
techiaith/banc-trawsgrifiadau-bangor (spontaneous, mixed dialects) | 33.33 | 12.25 | 36.36 | 54.43 |
techiaith/commonvoice-23-0-cy (read) | 37.56 | 11.15 | 41.39 | 38.20 |
| Test set | WER | CER | WER (greedy, no LM) | WER (24.10) |
|---|---|---|---|---|
techiaith/commonvoice-23-0-en/GB-IE (read, UK and Irish English) | 42.06 | 14.39 | 44.13 | 99.52 |
24.10 is techiaith/wav2vec2-btb-cv-ft-cv-cy,
the Unit's previous wav2vec2 release: the Banc Trawsgrifiadau Bangor + Common Voice model
fine-tuned further on Common Voice 18 with its encoder frozen. That made it a read-speech
specialist, which is why it comes closest on the two read sets while trailing far behind
on spontaneous speech. It is Welsh-only, so its figure on the English set measures nothing
but that.
| Dataset | Language | Split | Revision | Licence | Access | Datasheet |
|---|---|---|---|---|---|---|
| techiaith/banc-trawsgrifiadau-bangor | Welsh | train | 26.07 | CC0 1.0 | public | datasheet |
| techiaith/corpws-clllc-wlga | Welsh | clips | 5d00294c31 | CC0 1.0 | public | datasheet |
techiaith/commonvoice_23_0_cy | Welsh | train+dev[50%:] | main | CC0 1.0 | private † | datasheet |
| cymen-arfor/lleisiau-arfor | Welsh | train | main | CC0 1.0 | public | datasheet |
techiaith/commonvoice_vad_cy | Welsh | train | main | CC0 1.0 | private † | datasheet |
techiaith/commonvoice_23_0_en__GB_IE | English | train[:10%] | main | CC0 1.0 | private † | datasheet |
† Common Voice data is not redistributed here. techiaith/commonvoice_23_0_cy (Common Voice 23.0 Welsh), techiaith/commonvoice_vad_cy (Common Voice Welsh, VAD-segmented), techiaith/commonvoice_23_0_en__GB_IE (Common Voice 23.0 English, GB and IE accents) are held in private repositories, in line with the Mozilla Foundation's terms for obtaining and sharing Common Voice data. They are listed above for provenance and reproducibility, not as a download.
The Welsh and English Common Voice corpora are freely available from Mozilla themselves: Mozilla Common Voice datasets. Releases are distributed through the Mozilla Data Collective, and the datacollective package offers a programmatic download. With that in hand the rest of this pipeline is reproducible — every other dataset in the table is openly available on the Hugging Face Hub. Our thanks to Mozilla and to the speakers who contributed their voices.
As materialised for training, after curation and the duration filter: 142.8 hours of Welsh and 22.4 hours of English:
| Source | Language | Utterances | Hours |
|---|---|---|---|
techiaith/banc-trawsgrifiadau-bangor | Welsh | 46,041 | 55.6 |
techiaith/corpws-clllc-wlga | Welsh | 24,297 | 39.3 |
cymen-arfor/lleisiau-arfor | Welsh | 26,424 | 29.3 |
techiaith/commonvoice_23_0_cy | Welsh | 10,721 | 15.7 |
techiaith/commonvoice_vad_cy | Welsh | 5,355 | 2.9 |
techiaith/commonvoice_23_0_en__GB_IE | English | 16,438 | 22.4 |
| total | 129,276 | 165.2 |
| Parameter | Value |
|---|---|
| Base model | facebook/wav2vec2-large-xlsr-53 |
| Objective | character-level CTC |
| Feature encoder | frozen |
| Learning rate | 0.0003 |
| LR scheduler | cosine |
| Warmup steps | 1000 |
| Training steps | 18000 |
| Weight decay | 0.01 |
| Batch size | 8 × 4 accumulation × 1 GPU = 32 effective |
| Mixed precision | fp16 |
| SpecAugment | time masking, p = 0.05, span 10 |
| Dropout | attention 0.1, hidden 0.1, feature projection 0.1, final 0.1 |
| Clip duration | 1–20 s |
| Boundary curation | yes |
| Checkpoint selection | lowest wer on the validation split |
| Alphabet | 42 characters — a–z, à â ä ê ë î ï ò ô ú û ŵ ŷ, apostrophe, hyphen and the word boundary — plus [UNK] and [PAD] |
| Training rows | 129,276 utterances (165.2 h) after the task filter (802 translate rows dropped), boundary curation (1,921 suspect rows dropped) and the 1–20 s duration filter |
| Epochs | 4.5 |
| Hardware | 1 × NVIDIA RTX A6000, 3 h 51 min |
| Framework | transformers 5.17.0, PyTorch 2.14.0 |
The repository carries a KenLM 5-gram language model in
language_model/, with the matching alphabet.json, for beam-search decoding with
pyctcdecode. It is estimated on
the transcripts of the training split only, decoded back from the labels the CTC head was trained on (so its vocabulary cannot contain a word the acoustic model is unable to produce; no validation or test transcript was used), 74,500 distinct words, with decoder weights alpha = 0.5 and
beta = 1.5. Loading the model with Wav2Vec2ProcessorWithLM (below) uses it; loading
with Wav2Vec2Processor decodes the acoustic model alone, greedily. The acoustic model is the
same in both cases (training tag 2607-20261021).
pip install transformers torch librosa pyctcdecode kenlm
With the n-gram decoder (recommended):
import librosa
import torch
from transformers import Wav2Vec2ForCTC, Wav2Vec2ProcessorWithLM
processor = Wav2Vec2ProcessorWithLM.from_pretrained("techiaith/wav2vec2-xlsr-53-ft-cy-en", revision="26.10")
model = Wav2Vec2ForCTC.from_pretrained("techiaith/wav2vec2-xlsr-53-ft-cy-en", revision="26.10").eval()
audio, _ = librosa.load("welsh_audio.wav", sr=16_000)
inputs = processor(audio, sampling_rate=16_000, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
print(processor.batch_decode(logits.numpy()).text[0])
Acoustic model only (greedy CTC decoding, no language model):
import librosa
import torch
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
processor = Wav2Vec2Processor.from_pretrained("techiaith/wav2vec2-xlsr-53-ft-cy-en", revision="26.10")
model = Wav2Vec2ForCTC.from_pretrained("techiaith/wav2vec2-xlsr-53-ft-cy-en", revision="26.10").eval()
audio, _ = librosa.load("welsh_audio.wav", sr=16_000)
inputs = processor(audio, sampling_rate=16_000, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
print(processor.batch_decode(torch.argmax(logits, dim=-1))[0])
The model was trained on clips of up to 20 seconds. Split longer recordings on silences first, or let the transformers pipeline chunk them:
from transformers import pipeline
pipe = pipeline("automatic-speech-recognition", model="techiaith/wav2vec2-xlsr-53-ft-cy-en", revision="26.10", chunk_length_s=20)
print(pipe("long_recording.wav")["text"])
The model transcribes Welsh speech, and English speech with UK and Irish accents, to text. It is a research model, not a certified product, and is not a substitute for a qualified transcriber.
Automatic transcription makes mistakes. Output can be wrong while appearing fluent and confident. Known failure modes include omitted, inserted or substituted words; misspelt names and place names; numbers written as words or dropped, since the alphabet has no digits; English words in Welsh speech, and Welsh words in English speech, spelt as the other language, since the model does not identify the language being spoken; and reduced accuracy on dialect, overlapping speakers, noisy or distant audio, and subjects outside the training data. Output is lowercase and carries no punctuation. Treat output as provisional and have it checked and corrected by a competent person before it is relied on as a record, used in any decision affecting a person, or shared or published. Where the model is used interactively or in real time (live captions, dictation), tell users that what they see is an automatic transcription and may be wrong.
Not fit for medical, legal, financial, safety-critical or emergency settings, or any decision affecting a person's rights, health, liberty or livelihood, unless a qualified person reviews every output.
Use in Wales. The model was developed to help organisations provide services in Welsh that are as good as those they provide in English, not to replace Welsh-language provision. Under section 1 of the Welsh Language (Wales) Measure 2011 (2011 nawm 1), Welsh has official status in Wales, and that status is given legal effect by, among other things, the treatment of Welsh no less favourably than English (s. 1(2)(b)) and by standards of conduct relating to the use of Welsh (s. 1(3)(e)). These standards are made and enforced under Part 4 of the Measure. Bodies still operating a Welsh language scheme under Part II of the Welsh Language Act 1993 (c. 38) must give effect to the principle in section 5 of that Act that, in the conduct of public business and the administration of justice in Wales, Welsh and English should be treated on a basis of equality. Which duties apply depends on the body and the regulations or scheme that cover it, and responsibility for compliance rests with the body deploying the model. See the Welsh Language Commissioner's regulatory policy statement on artificial intelligence and the Welsh language, Technology, Websites and Software: Welsh Language Considerations, and the advice document Bilingual drafting, translation and using Welsh face to face. The legislation is at legislation.gov.uk/mwa/2011/1 and legislation.gov.uk/ukpga/1993/38.
Further limitations:
trainer_state.json is not a result. It selected the checkpoint; the Common Voice half of that validation split overlaps the training slice, so read the model's accuracy off the benchmark tables above.Released under the Apache License 2.0. The accompanying NOTICE file carries the University's attribution, the warning that automatic transcription makes mistakes, and the attributions required by the training-data and base-model licences. Section 4 of the licence requires anyone who redistributes the model or a derivative to keep that NOTICE.
One-line attribution: Includes wav2vec2-xlsr-53-ft-cy-2607, developed by the Language Technologies Unit, Bangor University, and released under the Apache License 2.0.
Built on XLSR-53, pre-trained and released by Meta AI under the Apache License 2.0.
Developed by Uned Technolegau Iaith, Prifysgol Bangor / Language Technologies Unit, Bangor University.
Funded by the Welsh Government.