romanian-wav2vec2

gigant/romanian-wav2vec2

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

language:

  • ro license: apache-2.0 tags:
  • automatic-speech-recognition
  • hf-asr-leaderboard
  • robust-speech-event datasets:
  • mozilla-foundation/common_voice_8_0
  • gigant/romanian_speech_synthesis_0_8_1 base_model: facebook/wav2vec2-xls-r-300m model-index:
  • name: wav2vec2-ro-300m_01 results:
    • task: type: automatic-speech-recognition name: Automatic Speech Recognition dataset: name: Robust Speech Event type: speech-recognition-community-v2/dev_data args: ro metrics:
      • type: wer value: 46.99 name: Dev WER (without LM)
      • type: cer value: 16.04 name: Dev CER (without LM)
      • type: wer value: 38.63 name: Dev WER (with LM)
      • type: cer value: 14.52 name: Dev CER (with LM)
    • task: type: automatic-speech-recognition name: Automatic Speech Recognition dataset: name: Common Voice type: mozilla-foundation/common_voice_8_0 args: ro metrics:
      • type: wer value: 11.73 name: Test WER (without LM)
      • type: cer value: 2.93 name: Test CER (without LM)
      • type: wer value: 7.31 name: Test WER (with LM)
      • type: cer value: 2.17 name: Test CER (with LM)
    • task: type: automatic-speech-recognition name: Automatic Speech Recognition dataset: name: Robust Speech Event - Test Data type: speech-recognition-community-v2/eval_data args: ro metrics:
      • type: wer value: 43.23 name: Test WER

You can test this model online with the Space for Romanian Speech Recognition

The model ranked TOP-1 on Romanian Speech Recognition during HuggingFace's Robust Speech Challenge :

Romanian Wav2Vec2

This model is a fine-tuned version of facebook/wav2vec2-xls-r-300m on the Common Voice 8.0 - Romanian subset dataset, with extra training data from Romanian Speech Synthesis dataset.

Without the 5-gram Language Model optimization, it achieves the following results on the evaluation set (Common Voice 8.0, Romanian subset, test split):

  • Loss: 0.1553
  • Wer: 0.1174
  • Cer: 0.0294

Model description

The architecture is based on facebook/wav2vec2-xls-r-300m with a speech recognition CTC head and an added 5-gram language model (using pyctcdecode and kenlm) trained on the Romanian Corpora Parliament dataset. Those libraries are needed in order for the language model-boosted decoder to work.

Intended uses & limitations

The model is made for speech recognition in Romanian from audio clips sampled at 16kHz. The predicted text is lowercased and does not contain any punctuation.

How to use

Make sure you have installed the correct dependencies for the language model-boosted version to work. You can just run this command to install the kenlm and pyctcdecode libraries :

pip install https://github.com/kpu/kenlm/archive/master.zip pyctcdecode

With the framework transformers you can load the model with the following code :

from transformers import AutoProcessor, AutoModelForCTC

processor = AutoProcessor.from_pretrained("gigant/romanian-wav2vec2")

model = AutoModelForCTC.from_pretrained("gigant/romanian-wav2vec2")

Or, if you want to test the model, you can load the automatic speech recognition pipeline from transformers with :

from transformers import pipeline

asr = pipeline("automatic-speech-recognition", model="gigant/romanian-wav2vec2")

Example use with the datasets library

First, you need to load your data

We will use the Romanian Speech Synthesis dataset in this example.

from datasets import load_dataset

dataset = load_dataset("gigant/romanian_speech_synthesis_0_8_1")

You can listen to the samples with the IPython.display library :

from IPython.display import Audio

i = 0
sample = dataset["train"][i]
Audio(sample["audio"]["array"], rate = sample["audio"]["sampling_rate"])

The model is trained to work with audio sampled at 16kHz, so if the sampling rate of the audio in the dataset is different, we will have to resample it.

In the example, the audio is sampled at 48kHz. We can see this by checking dataset["train"][0]["audio"]["sampling_rate"]

The following code resample the audio using the torchaudio library :

import torchaudio
import torch

i = 0
audio = sample["audio"]["array"]
rate = sample["audio"]["sampling_rate"]
resampler = torchaudio.transforms.Resample(rate, 16_000)
audio_16 = resampler(torch.Tensor(audio)).numpy()

To listen to the resampled sample :

Audio(audio_16, rate=16000)

Know you can get the model prediction by running

predicted_text = asr(audio_16)
ground_truth = dataset["train"][i]["sentence"]

print(f"Predicted text : {predicted_text}")
print(f"Ground truth : {ground_truth}")

Training and evaluation data

Training data :

Evaluation data :

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 0.003
  • train_batch_size: 16
  • eval_batch_size: 8
  • seed: 42
  • gradient_accumulation_steps: 3
  • total_train_batch_size: 48
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • lr_scheduler_warmup_steps: 500
  • num_epochs: 50.0
  • mixed_precision_training: Native AMP

Training results

Training LossEpochStepValidation LossWerCer
2.92720.785000.76030.77340.2355
0.61571.5510000.40030.48660.1247
0.44522.3315000.29600.36890.0910
0.36313.1120000.25800.32050.0796
0.31533.8825000.24650.29770.0747
0.27954.6630000.22740.27890.0694
0.26155.4335000.22770.26850.0675
0.23896.2140000.21350.25180.0627
0.22296.9945000.20540.24490.0614
0.20677.7650000.20960.23780.0597
0.19778.5455000.20420.23870.0600
0.18969.3260000.21100.23830.0595
0.180110.0965000.19090.21650.0548
0.17410.8770000.18830.22060.0559
0.168511.6575000.18480.20970.0528
0.159112.4280000.18510.20390.0514
0.153713.285000.18810.20650.0518
0.150413.9790000.18400.19720.0499
0.14514.7595000.18450.20290.0517
0.141715.53100000.18840.20030.0507
0.136416.3105000.20100.20370.0517
0.133117.08110000.18380.19230.0483
0.12917.86115000.18180.19220.0489
0.119818.63120000.17600.18610.0465
0.120319.41125000.16860.18390.0465
0.122520.19130000.18280.19200.0479
0.114520.96135000.16730.17840.0446
0.105321.74140000.18020.18100.0456
0.107122.51145000.17690.17750.0444
0.105323.29150000.19200.17830.0457
0.102424.07155000.19040.17750.0446
0.098724.84160000.17930.17620.0446
0.094925.62165000.18010.17660.0443
0.094226.4170000.17310.16590.0423
0.090627.17175000.17760.16980.0424
0.086127.95180000.17160.16000.0406
0.085128.73185000.16620.16300.0410
0.084429.5190000.16710.15720.0393
0.079230.28195000.17680.15990.0407
0.079831.06200000.17320.15580.0394
0.077931.83205000.16940.15440.0388
0.071832.61210000.17090.15780.0399
0.073233.38215000.16970.15230.0391
0.070834.16220000.16160.14740.0375
0.067834.94225000.16980.14740.0375
0.064235.71230000.16810.14590.0369
0.066136.49235000.16120.14110.0357
0.062937.27240000.16620.14140.0355
0.058738.04245000.16590.14080.0351
0.058138.82250000.16120.13820.0352
0.055639.6255000.16470.13760.0345
0.054340.37260000.16580.13350.0337
0.05241.15265000.17160.13690.0343
0.051341.92270000.16000.13170.0330
0.049142.7275000.16710.13110.0328
0.046343.48280000.16130.12890.0324
0.046844.25285000.15990.12600.0315
0.043545.03290000.15560.12320.0308
0.04345.81295000.15880.12400.0309
0.042146.58300000.15670.12170.0308
0.0447.36305000.15330.11980.0302
0.038948.14310000.15820.11850.0297
0.038748.91315000.15760.11870.0297
0.037649.69320000.15600.11820.0295

Framework versions

  • Transformers 4.16.2
  • Pytorch 1.10.0+cu111
  • Tokenizers 0.11.0
  • pyctcdecode 0.3.0
  • kenlm

内容来源:Hugging Face 模型卡

在 Hugging Face 查看