mozilla-foundation/common_voice_17_0
Updated • 5.5k • 16
How to use aictsharif/whisper-base-fa with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("automatic-speech-recognition", model="aictsharif/whisper-base-fa") # Load model directly
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
processor = AutoProcessor.from_pretrained("aictsharif/whisper-base-fa")
model = AutoModelForSpeechSeq2Seq.from_pretrained("aictsharif/whisper-base-fa")This model is a fine-tuned version of openai/whisper-base on the Common Voice 17.0 dataset.
The following hyperparameters were used during training:
import torch
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
model_id = "aictsharif/whisper-base-fa"
model = AutoModelForSpeechSeq2Seq.from_pretrained(
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
)
model.to(device)
processor = AutoProcessor.from_pretrained(model_id)
pipe = pipeline(
"automatic-speech-recognition",
model=model,
tokenizer=processor.tokenizer,
feature_extractor=processor.feature_extractor,
torch_dtype=torch_dtype,
device=device,
)
result = pipe('sample.mp3')
print(result["text"])
Base model
openai/whisper-base