LoRA adapter for openai/whisper-large-v3, fine-tuned on
Moroccan Arabic (Darija) speech from the DODa audio dataset.
This adapter is one of several models trained during a research project on automatic speech recognition for code-switched Moroccan Darija.
This repository contains only the adapter (and the processor): load it on top of the base model.
import torch, librosa
from transformers import WhisperForConditionalGeneration, WhisperProcessor
from peft import PeftModel
base = WhisperForConditionalGeneration.from_pretrained(
"openai/whisper-large-v3", torch_dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(base, "AhmedTaOu/whisper-large-v3-darija-lora-2").eval()
processor = WhisperProcessor.from_pretrained("AhmedTaOu/whisper-large-v3-darija-lora-2")
audio, _ = librosa.load("audio.wav", sr=16000)
features = processor.feature_extractor(audio, sampling_rate=16000, return_tensors="pt").input_features
with torch.no_grad():
ids = model.generate(input_features=features.to(model.device, torch.float16),
language="arabic", task="transcribe")
print(processor.tokenizer.batch_decode(ids, skip_special_tokens=True)[0])
| Base model | openai/whisper-large-v3 |
| Method | LoRA (r=8, alpha=16, dropout=0.05) on decoder attention only (self-attention and cross-attention q_proj, v_proj); the encoder is frozen |
| Data | DODa audio, text column darija_Arab_new; clips of 0.2–30 s; 10178 train / 1271 validation / 1272 test utterances after filtering |
| Split | random 80/10/10 split by utterance |
| Optimization | 400 steps (≈ 2.5 epochs), effective batch size 64, lr 0.0001, cosine schedule, 50 warmup steps, weight decay 0.01, fp16 |
| Hardware | Tesla T4 |
| Software | transformers 5.23.0, peft 0.21.3, datasets 3.6.0, torch 2.14.1 |
Held-out test split of DODa, 1272 utterances, greedy decoding, language="arabic".
"Raw" only applies Unicode NFC and whitespace normalization; "normalized" additionally removes punctuation,
diacritics and tatweel (Darija orthography is highly variable, so raw scores are harsh).
| WER raw | CER raw | WER normalized | CER normalized | |
|---|---|---|---|---|
| Whisper large-v3 (zero-shot) | 76.2% | 34.8% | 74.4% | 34.0% |
| + this adapter | 47.6% | 16.3% | 47.1% | 16.1% |
Base model: OpenAI Whisper. Data: DODa audio dataset (AtlasIA), released under the MIT license.
@misc{doda_audio_2025,
author = {Bidry, Mahmoud and Zaidoune, Youssef and others},
title = {Moroccan Darija Speech Dataset},
year = {2025},
organization = {AtlasIA},
howpublished = {Hugging Face Datasets}
}
openai/whisper-large-v3