Views
No views yet
openai/whisper-medium fine-tuned on the full SADA22
dataset (~420 hours of Saudi Arabic speech) for Arabic automatic speech recognition (ASR).| Setting | Value |
|---|---|
| Base model | openai/whisper-medium (~764M parameters) |
| Dataset | SADA22 (full, ~420 h of Saudi Arabic) |
| Language | Arabic |
| Task | transcribe |
| Epochs | 4 |
| Learning rate | 1e-5 |
| Batch size | 8 |
| Gradient accumulation steps | 1 |
| Warmup ratio | 0.1 |
| FP16 | yes |
pip install torch "transformers>=4.27" torchaudio safetensors1import torch
2import torchaudio
3from transformers import WhisperForConditionalGeneration, WhisperProcessor
4
5model = WhisperForConditionalGeneration.from_pretrained("wageehkhad/whisper-medium-finetuned-sada-asr")
6processor = WhisperProcessor.from_pretrained("wageehkhad/whisper-medium-finetuned-sada-asr")
7
8
9def transcribe(audio_path: str, device: str = "cpu") -> str:
10 """
11 Transcribe an Arabic audio file.
12 Accepts any format supported by torchaudio (WAV, FLAC, MP3, etc.).
13 """
14 wav, sr = torchaudio.load(audio_path)
15 wav = torchaudio.functional.resample(wav, sr, 16_000).mean(0).numpy()
16
17 inputs = processor(
18 wav,
19 sampling_rate=16_000,
20 return_tensors="pt",
21 return_attention_mask=True,
22 ).to(device)
23 model.to(device)
24
25 with torch.no_grad():
26 token_ids = model.generate(
27 inputs.input_features,
28 attention_mask=inputs.attention_mask,
29 language="arabic",
30 task="transcribe",
31 )
32
33 return processor.batch_decode(token_ids, skip_special_tokens=True)[0]
34
35# Example
36print(transcribe("example.wav"))
37ImportError: TorchCodec is required for load_with_torchcodecpip install torchcodecAudio → [this model] → Arabic transcript → [AMR-KELEG/Sentence-ALDi] → ALDi score1from transformers import pipeline, AutoModelForSequenceClassification, AutoTokenizer
2import torch
3
4# Step 1: transcribe
5asr = pipeline("automatic-speech-recognition",
6 model="wageehkhad/whisper-medium-finetuned-sada-asr")
7result = asr("speech.wav", generate_kwargs={"language": "arabic", "task": "transcribe"})
8transcript = result["text"]
9
10# Step 2: score dialect level
11aldi_tok = AutoTokenizer.from_pretrained("AMR-KELEG/Sentence-ALDi")
12aldi_mdl = AutoModelForSequenceClassification.from_pretrained("AMR-KELEG/Sentence-ALDi")
13aldi_mdl.eval()
14
15enc = aldi_tok(transcript, return_tensors="pt", truncation=True, max_length=256)
16with torch.no_grad():
17 score = float(aldi_mdl(**enc).logits.squeeze())
18
19print(f"Transcript : {transcript}")
20print(f"ALDi score : {score:.3f}") # 0.0 = MSA, 1.0 = heavy dialect1@inproceedings{keleg2023aldi,
2 title = {ALDi: Quantifying the Arabic Level of Dialectness of Text},
3 author = {Keleg, Amr and Goldwater, Sharon and Magdy, Walid},
4 booktitle = {Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
5 year = {2023},
6 publisher = {Association for Computational Linguistics},
7 address = {Singapore},
8 url = {https://aclanthology.org/2023.emnlp-main.655}
9}
10
11@misc{sada22,
12 author = {Al-Gamdi, Ahmed and others},
13 title = {SADA: Saudi Audio Dataset for Arabic},
14 year = {2022},
15 howpublished = {\url{https://huggingface.co/datasets/MohamedRashad/SADA22}},
16 note = {Accessed 2026}
17}