mozilla-foundation/common_voice_17_0
Updated • 4.98k • 35
How to use UmarRamzan/w2v2-bert-ngram-urdu with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("automatic-speech-recognition", model="UmarRamzan/w2v2-bert-ngram-urdu") # Load model directly
from transformers import AutoProcessor, AutoModelForCTC
processor = AutoProcessor.from_pretrained("UmarRamzan/w2v2-bert-ngram-urdu")
model = AutoModelForCTC.from_pretrained("UmarRamzan/w2v2-bert-ngram-urdu", device_map="auto")This model is a fine-tuned version of facebook/w2v-bert-2.0 on the Urdu split of the Common Voice 17 dataset. The fine-tuned model is enhanced with the addition of an ngram language model that has also been trained on the same dataset. It achieves the following results on the evaluation set:
from transformers import AutoFeatureExtractor, Wav2Vec2BertModel
import torch
from datasets import load_dataset
dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
dataset = dataset.sort("id")
sampling_rate = dataset.features["audio"].sampling_rate
processor = AutoProcessor.from_pretrained("UmarRamzan/w2v2-bert-ngram-urdu")
model = Wav2Vec2BertModel.from_pretrained("UmarRamzan/w2v2-bert-ngram-urdu")
# audio file is decoded on the fly
inputs = processor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
The following hyperparameters were used during training:
Unable to build the model tree, the base model loops to the model itself. Learn more.