wav2vec2-xls-r-300m-cs-250

comodoro/wav2vec2-xls-r-300m-cs-250

作者
comodoro
任务
语音识别
下载量
1,508,502
点赞数
13
趋势分
0
许可证
apache-2.0
收录时间
2026/11/4

language:

  • cs license: apache-2.0 tags:
  • automatic-speech-recognition
  • generated_from_trainer
  • hf-asr-leaderboard
  • mozilla-foundation/common_voice_8_0
  • robust-speech-event
  • xlsr-fine-tuning-week datasets:
  • mozilla-foundation/common_voice_8_0
  • ovm
  • pscr
  • vystadial2016 base_model: facebook/wav2vec2-xls-r-300m model-index:
  • name: Czech comodoro Wav2Vec2 XLSR 300M 250h data results:
    • task: type: automatic-speech-recognition name: Automatic Speech Recognition dataset: name: Common Voice 8 type: mozilla-foundation/common_voice_8_0 args: cs metrics:
      • type: wer value: 7.3 name: Test WER
      • type: cer value: 2.1 name: Test CER
    • task: type: automatic-speech-recognition name: Automatic Speech Recognition dataset: name: Robust Speech Event - Dev Data type: speech-recognition-community-v2/dev_data args: cs metrics:
      • type: wer value: 43.44 name: Test WER
    • task: type: automatic-speech-recognition name: Automatic Speech Recognition dataset: name: Robust Speech Event - Test Data type: speech-recognition-community-v2/eval_data args: cs metrics:
      • type: wer value: 38.5 name: Test WER

Czech wav2vec2-xls-r-300m-cs-250

This model is a fine-tuned version of facebook/wav2vec2-xls-r-300m on the common_voice 8.0 dataset as well as other datasets listed below.

It achieves the following results on the evaluation set:

  • Loss: 0.1271
  • Wer: 0.1475
  • Cer: 0.0329

The eval.py script results using a LM are:

  • WER: 0.07274312090176113
  • CER: 0.021207369275558875

Model description

Fine-tuned facebook/wav2vec2-large-xlsr-53 on Czech using the Common Voice dataset. When using this model, make sure that your speech input is sampled at 16kHz.

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

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

test_dataset = load_dataset("mozilla-foundation/common_voice_8_0", "cs", split="test[:2%]")

processor = Wav2Vec2Processor.from_pretrained("comodoro/wav2vec2-xls-r-300m-cs-250")
model = Wav2Vec2ForCTC.from_pretrained("comodoro/wav2vec2-xls-r-300m-cs-250")

resampler = torchaudio.transforms.Resample(48_000, 16_000)

# Preprocessing the datasets.
# We need to read the aduio files as arrays
def speech_file_to_array_fn(batch):
	speech_array, sampling_rate = torchaudio.load(batch["path"])
	batch["speech"] = resampler(speech_array).squeeze().numpy()
	return batch

test_dataset = test_dataset.map(speech_file_to_array_fn)
inputs = processor(test_dataset[:2]["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)

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

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

print("Prediction:", processor.batch_decode(predicted_ids))
print("Reference:", test_dataset[:2]["sentence"])

Evaluation

The model can be evaluated using the attached eval.py script:

python eval.py --model_id comodoro/wav2vec2-xls-r-300m-cs-250 --dataset mozilla-foundation/common-voice_8_0 --split test --config cs

Training and evaluation data

The Common Voice 8.0 train and validation datasets were used for training, as well as the following datasets:

  • Šmídl, Luboš and Pražák, Aleš, 2013, OVM – Otázky Václava Moravce, LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (ÚFAL), Faculty of Mathematics and Physics, Charles University, http://hdl.handle.net/11858/00-097C-0000-000D-EC98-3.

  • Pražák, Aleš and Šmídl, Luboš, 2012, Czech Parliament Meetings, LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (ÚFAL), Faculty of Mathematics and Physics, Charles University, http://hdl.handle.net/11858/00-097C-0000-0005-CF9C-4.

  • Plátek, Ondřej; Dušek, Ondřej and Jurčíček, Filip, 2016, Vystadial 2016 – Czech data, LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (ÚFAL), Faculty of Mathematics and Physics, Charles University, http://hdl.handle.net/11234/1-1740.

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 0.0001
  • train_batch_size: 32
  • eval_batch_size: 8
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • lr_scheduler_warmup_steps: 800
  • num_epochs: 5
  • mixed_precision_training: Native AMP

Training results

Training LossEpochStepValidation LossWerCer
3.42030.168003.31481.01.0
2.81510.3216000.85080.89380.2345
0.94110.4824000.33350.37230.0847
0.74080.6432000.25730.28400.0642
0.65160.840000.23650.25810.0595
0.62420.9648000.20390.24330.0541
0.57541.1256000.18320.21560.0482
0.56261.2864000.18270.20910.0463
0.53421.4472000.17440.20330.0468
0.49651.680000.17050.19630.0444
0.50471.7688000.16040.18890.0422
0.48141.9296000.16040.18270.0411
0.44712.09104000.15660.18220.0406
0.45092.25112000.16190.18530.0432
0.44152.41120000.15130.17640.0397
0.43132.57128000.15150.17390.0392
0.41632.73136000.14450.16950.0377
0.41422.89144000.14780.16990.0385
0.41843.05152000.14300.16690.0376
0.38863.21160000.14330.16440.0374
0.37953.37168000.14260.16480.0373
0.38593.53176000.13570.16040.0361
0.37623.69184000.13440.15580.0349
0.3843.85192000.13790.15760.0359
0.37624.01200000.13440.15390.0346
0.35594.17208000.13390.15250.0351
0.36834.33216000.13150.15180.0342
0.35724.49224000.13070.15070.0342
0.34944.65232000.12940.14910.0335
0.34764.81240000.12870.14910.0336
0.34754.97248000.12710.14750.0329

Framework versions

  • Transformers 4.16.2
  • Pytorch 1.10.1+cu102
  • Datasets 1.18.3
  • Tokenizers 0.11.0

内容来源:Hugging Face 模型卡

在 Hugging Face 查看