Views
No views yet
ahishamm/QURANICWhisperDataset test set.transformers pipeline.1from transformers import pipeline
2
3# Load the pipeline with automatic device mapping for multi-GPU setups
4pipe = pipeline(
5 "automatic-speech-recognition",
6 model="MaddoggProduction/whisper-small-quran-lora-everyayah",
7 device_map="auto" # auto for multiple GPUs, n: for GPU n, -1: for CPU
8)
9
10# Transcribe audio with chunking
11result = pipe(
12 "path_to_audio.mp3",
13 chunk_length_s=30,
14 stride_length_s=3,
15 batch_size=8,
16 return_timestamps=True,
17 generate_kwargs={
18 "task": "transcribe",
19 "language": "arabic",
20 #"temperature": 0.0, # Greedy decoding, recommended for stability. Adjust as needed
21 #"num_beams": 5, # Adjust as needed, 5 for stability
22 }
23)
24
25print(result["text"])