CoolFace
Modelpublic

kingabzpro/wav2vec2-large-xlsr-53-punjabi

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
4likes265kdownloads
Model Card

<!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. -->

wav2vec2-large-xlsr-53-punjabi

This model is a fine-tuned version of Harveenchadha/vakyansh-wav2vec2-punjabi-pam-10 on the common_voice dataset. It achieves the following results on the evaluation set:

  • —Loss: 1.2101
  • —Wer: 0.4939
  • —Cer: 0.2238
Evaluation Commands
  1. 1.To evaluate on mozilla-foundation/common_voice_8_0 with split test
bash
python eval.py --model_id kingabzpro/wav2vec2-large-xlsr-53-punjabi --dataset mozilla-foundation/common_voice_8_0 --config pa-IN --split test

Inference With LM

python
import torch
from datasets import load_dataset
from transformers import AutoModelForCTC, AutoProcessor
import torchaudio.functional as F
model_id = "kingabzpro/wav2vec2-large-xlsr-53-punjabi"
sample_iter = iter(load_dataset("mozilla-foundation/common_voice_8_0", "pa-IN", split="test", streaming=True, use_auth_token=True))
sample = next(sample_iter)
resampled_audio = F.resample(torch.tensor(sample["audio"]["array"]), 48_000, 16_000).numpy()
model = AutoModelForCTC.from_pretrained(model_id)
processor = AutoProcessor.from_pretrained(model_id)
input_values = processor(resampled_audio, return_tensors="pt").input_values
with torch.no_grad():
    logits = model(input_values).logits
transcription = processor.batch_decode(logits.numpy()).text

Training hyperparameters

The following hyperparameters were used during training:

  • —learning_rate: 0.0003
  • —trainbatchsize: 16
  • —evalbatchsize: 8
  • —seed: 42
  • —gradientaccumulationsteps: 2
  • —totaltrainbatch_size: 32
  • —optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • —lrschedulertype: linear
  • —lrschedulerwarmup_steps: 200
  • —num_epochs: 30
  • —mixedprecisiontraining: Native AMP

Training results

Training LossEpochStepValidation LossWerCer
11.05633.71001.94920.71230.3872
1.67157.412001.31420.64330.3086
0.911711.113001.27330.56570.2627
0.66614.814001.27300.55980.2534
0.422518.525001.25480.53000.2399
0.320922.226001.21660.52290.2372
0.267825.937001.17950.50410.2276
0.208829.638001.21010.49390.2238

Framework versions

  • —Transformers 4.17.0.dev0
  • —Pytorch 1.10.2+cu102
  • —Datasets 1.18.2.dev0
  • —Tokenizers 0.11.0