Downloads · 30 days
160
6% of all-time downloads
Paulwalker4884/whisper-persian
whisper-persian is a automatic speech recognition model from Paulwalker4884. Use it when you need speech turned into text. It is set up for transformers. The card lists the license as apache-2.0.
A fine-tuned Whisper model optimized for Persian (Farsi) speech-to-text conversion using LoRA (Low-Rank Adaptation) technique. This model provides real-time speech recognition capabilities for Persian language with hi…
Downloads · 30 days
160
6% of all-time downloads
All-time downloads
2.8K
Public
Parameters
72.6M
293 MB on disk
Likes
7
Public
Click a slice to open those files.
.safetensors293 MB · 98%
From the Hugging Face model README
A fine-tuned Whisper model optimized for Persian (Farsi) speech-to-text conversion using LoRA (Low-Rank Adaptation) technique. This model provides real-time speech recognition capabilities for Persian language with high accuracy.
This model is a fine-tuned version of OpenAI's Whisper-base model, specifically adapted for Persian language speech recognition. The model uses LoRA (Low-Rank Adaptation) for efficient fine-tuning while maintaining the original model's capabilities.
This model is designed for Persian speech-to-text conversion with real-time capabilities. It can be used to:
The model can be integrated into larger applications such as:
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
processor = AutoProcessor.from_pretrained("Paulwalker4884/whisper-persian")
model = AutoModelForSpeechSeq2Seq.from_pretrained("Paulwalker4884/whisper-persian")
First, install the required dependencies:
pip install transformers torch torchaudio numpy sounddevice
import numpy as np
import sounddevice as sd
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
import torch
# Load the fine-tuned Persian model
processor = AutoProcessor.from_pretrained("Paulwalker4884/whisper-persian")
model = AutoModelForSpeechSeq2Seq.from_pretrained("Paulwalker4884/whisper-persian").to("cpu")
# Record audio
duration = 5 # seconds
sample_rate = 16000
print("شروع ضبط...")
audio = sd.rec(int(duration * sample_rate), samplerate=sample_rate, channels=1)
sd.wait()
print("پایان ضبط.")
# Convert to 1D array
audio = np.squeeze(audio)
# Process audio
input_features = processor(audio, sampling_rate=sample_rate, return_tensors="pt").input_features
# Generate transcription
predicted_ids = model.generate(input_features)
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
print("متن شناسایی شده:")
print(transcription)
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
import torch
import torchaudio
# Load the model and processor
processor = AutoProcessor.from_pretrained("Paulwalker4884/whisper-persian")
model = AutoModelForSpeechSeq2Seq.from_pretrained("Paulwalker4884/whisper-persian")
# Load and preprocess audio
audio_path = "your_persian_audio.wav"
waveform, sample_rate = torchaudio.load(audio_path)
# Resample to 16kHz if necessary
if sample_rate != 16000:
resampler = torchaudio.transforms.Resample(sample_rate, 16000)
waveform = resampler(waveform)
# Process audio
input_features = processor(waveform.squeeze(), sampling_rate=16000, return_tensors="pt").input_features
# Generate transcription
with torch.no_grad():
predicted_ids = model.generate(input_features)
# Decode the transcription
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
print(f"Transcription: {transcription}")
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
import torch
import torchaudio
# Load the model and processor
processor = AutoProcessor.from_pretrained("Paulwalker4884/whisper-persian")
model = AutoModelForSpeechSeq2Seq.from_pretrained("Paulwalker4884/whisper-persian")
# For processing multiple audio files
def transcribe_persian_audio(audio_paths):
transcriptions = []
for audio_path in audio_paths:
waveform, sample_rate = torchaudio.load(audio_path)
if sample_rate != 16000:
resampler = torchaudio.transforms.Resample(sample_rate, 16000)
waveform = resampler(waveform)
input_features = processor(waveform.squeeze(), sampling_rate=16000, return_tensors="pt").input_features
with torch.no_grad():
predicted_ids = model.generate(input_features)
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
transcriptions.append(transcription)
return transcriptions
# Usage
audio_files = ["audio1.wav", "audio2.wav", "audio3.wav"]
results = transcribe_persian_audio(audio_files)
The model was fine-tuned on Persian speech data to improve performance on Farsi language recognition tasks. The training focused on:
The model has been evaluated on Persian speech recognition benchmarks and shows improved performance over the base Whisper model for Persian language tasks.
If you use this model in your research or applications, please cite:
@misc{whisper-persian-paulwalker4884,
author = {Yasin Keykh},
title = {Whisper Persian Fine-tuned Model},
year = {2024},
publisher = {Hugging Face},
url = {https://huggingface.co/Paulwalker4884/whisper-persian}
}
Author: Yasin Keykh
For questions or issues regarding this model, please open an issue in the model repository or contact the author directly.
This model is based on OpenAI's Whisper and has been fine-tuned for Persian language speech recognition using modern parameter-efficient fine-tuning techniques.