Edit model card


This is a version of alvenir/wav2vec2-base-da finetuned for Danish ASR on the training set of the public NST dataset and the Danish part of Common Voice 9. The model is trained on 16kHz, so ensure that you use the same sample rate.

The model was trained using fairseq for 120.000 steps.


import torch
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor

# load model and tokenizer
processor = Wav2Vec2Processor.from_pretrained(
model = Wav2Vec2ForCTC.from_pretrained(

# load dataset and read soundfiles
ds = load_dataset("Alvenir/alvenir_asr_da_eval", split="test")

# tokenize
input_values = processor(
    ds[0]["audio"]["array"], return_tensors="pt", padding="longest"
).input_values  # Batch size 1

# retrieve logits
logits = model(input_values).logits

# take argmax and decode
predicted_ids = torch.argmax(logits, dim=-1)
transcription = processor.batch_decode(predicted_ids)


The table below shows the WER rate of four different Danish ASR models on three publicly available datasets (lower is better).

Model Alvenir NST CV9.0
Alvenir/wav2vec2-base-da-ft-nst 0.202 0.099 0.238
chcaa/alvenir-wav2vec2-base-da-nst-cv9 0.233 0.126 0.256
chcaa/xls-r-300m-nst-cv9-da 0.105 0.060 0.119
chcaa/xls-r-300m-danish-nst-cv9 0.082 0.051 0.108

The model was finetuned in collaboration with Alvenir.

Downloads last month