Views
No views yet
ahishamm/QURANICWhisperDataset test set (20% of the dataset).transformers pipeline.stride_length_s parameter. A long stride (e.g., 5s or more) can cause the model to lose context and enter infinite repetition loops. It is recommended to keep the stride length to around 2 or 3 seconds.1from transformers import pipeline
2
3# Load the pipeline
4pipe = pipeline(
5 "automatic-speech-recognition",
6 model="MaddoggProduction/whisper-l-v3-turbo-quran-lora-dataset-mix",
7 device=0 # for GPU usage, -1 for CPU
8)
9
10# Transcribe audio
11result = pipe(
12 "path_to_audio.mp3",
13 chunk_length_s=30,
14 stride_length_s=2, # 2s or 3s to prevent loops and hallucinations
15 batch_size=8,
16 return_timestamps=True,
17 generate_kwargs={
18 "task": "transcribe",
19 "language": "arabic",
20 "num_beams": 1 # 1 is sufficient, adjust as needed
21 }
22)
23
24print(result["text"])