Downloads · 30 days
10
1% of all-time downloads
AlirezaSaei/wav2vec2-large-xlsr-persian-fine-tuned
wav2vec2-large-xlsr-persian-fine-tuned is a automatic speech recognition model from AlirezaSaei. Use it when you need speech turned into text. It is set up for transformers.
This model is a fine-tuned version of facebook/wav2vec2-large-xlsr-53 on Persian language data from the Mozilla Common Voice Dataset. The model is fine-tuned for automatic speech recognition (ASR) tasks.
Downloads · 30 days
10
1% of all-time downloads
All-time downloads
702
Public
Parameters
315M
2.5 GB on disk
Likes
4
Public
Click a slice to open those files.
.safetensors1.3 GB · 100%
From the Hugging Face model README
This model is a fine-tuned version of facebook/wav2vec2-large-xlsr-53 on Persian language data from the Mozilla Common Voice Dataset. The model is fine-tuned for automatic speech recognition (ASR) tasks.
This model can be used directly for transcribing Persian speech to text but it needs to be further fine-tuned with data.
The model can be fine-tuned further for specific ASR tasks or integrated into larger speech-processing pipelines.
The model is not suitable for languages other than Persian and may not perform well on noisy audio or speech with heavy accents not represented in the training data.
The model is trained on a dataset that may not cover all variations of the Persian language, leading to potential biases in recognizing less represented dialects or accents.
Users should be aware of the biases, risks, and limitations. Further fine-tuning on diverse datasets is recommended to mitigate these biases.
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
import torch
import torchaudio
# Load processor and model
processor = Wav2Vec2Processor.from_pretrained("AlirezaSaei/wav2vec2-large-xlsr-persian-fine-tuned")
model = Wav2Vec2ForCTC.from_pretrained("AlirezaSaei/wav2vec2-large-xlsr-persian-fine-tuned")
# Load audio file
audio_input, _ = torchaudio.load("path_to_audio.wav")
# Preprocess and predict
inputs = processor(audio_input, sampling_rate=16000, return_tensors="pt", padding=True)
logits = model(**inputs).logits
predicted_ids = torch.argmax(logits, dim=-1)
transcription = processor.batch_decode(predicted_ids)
print("Transcription:", transcription)
The model is fine-tuned on the Mozilla Common Voice Dataset. The training data includes Persian speech samples, with lengths filtered between 4 and 6 seconds for training and up to 15 seconds for testing.
The audio is resampled from 48000 Hz to 16000 Hz. The tokenizer, feature extractor, and processor are defined using the Wav2Vec2CTCTokenizer, Wav2Vec2FeatureExtractor, and Wav2Vec2Processor classes.
The model is evaluated on a subset of the Mozilla Common Voice Dataset.
Evaluation is disaggregated by different lengths of audio samples.
Word Error Rate (WER) is used as the evaluation metric. It measures the percentage of words that are incorrectly predicted.
The model achieves a WER of 1.0 on the test data.
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
The model uses the Wav2Vec2 architecture, which is designed for automatic speech recognition.
Colab T4 GPU
Python Notebook (.ipynb)
For further information, contact me.