Downloads · 30 days
100
39% of all-time downloads
touati-kamel/whisper-algerian-darja-medium
whisper-algerian-darja-medium is a automatic speech recognition model from touati-kamel. Use it when you need speech turned into text. It is set up for peft. The card lists the license as mit.
<p align="center" <img src="https://raw.githubusercontent.com/huggingface/transformers/main/docs/source/en/imgs/whisperarchitecture.png" alt="Whisper Architecture" width="700"/ </p
Downloads · 30 days
100
39% of all-time downloads
All-time downloads
259
Public
Repo size
88.1 GB
Likes
1
Public
Click a slice to open those files.
.pt1.7 GB · 54%
From the Hugging Face model README
touati-kamel/whisper-algerian-darja-medium is an Automatic Speech Recognition (ASR) model specifically fine-tuned for Algerian Arabic (Darja / الدارجة الجزائرية).
Built on top of OpenAI's Whisper Medium (openai/whisper-medium, 769M base parameters / 833M total parameters), this model incorporates parameter-efficient LoRA adapters trained with 4-bit quantization (QLoRA) over a comprehensive sequential 3-phase curriculum covering conversational podcasts, spontaneous storytelling, and cultural narratives from the OddAdmix Algerian speech collection.
The model was evaluated iteratively across the three domain splits using Word Error Rate (WER %) and Cross-Entropy Evaluation Loss with Arabic dialect text normalization:
| Phase | Domain / Dataset | Epochs / Steps | Learning Rate | Best WER (%) | Final Eval Loss |
|---|---|---|---|---|---|
| Phase 1 | Kahwa Podcast (oddadmix/arabic-audio-collection-algerian-kahwa-postcast) | 2 epochs (9,886 steps) | $1 \times 10^{-4}$ | 0.68% | ~0.012 |
| Phase 2 | Loubna Stories (oddadmix/arabic-audio-collection-algerian-loubna-stories) | 2 epochs (20,650 steps) | $5 \times 10^{-5}$ | 0.34% | ~0.008 |
| Phase 3 | Rawi Storytelling (oddadmix/arabic-audio-collection-algerian-rawi) | 1 epoch (1,125 steps) | $2 \times 10^{-5}$ | 0.95% | 0.00612 |
Cumulative Training Progress: Total training ran for 31,661 cumulative optimization steps with cosine annealing learning rate schedules and automatic best-adapter preservation per phase.
| Benchmark Dataset | Whisper Small (244M) WER | Whisper Medium (769M) WER | Relative Improvement |
|---|---|---|---|
| OddAdmix Kahwa Podcast | 34.85% | 0.68% | +98.0% |
| OddAdmix Loubna Stories | 14.87% | 0.34% | +97.7% |
| OddAdmix Rawi Stories | 27.54% | 0.95% | +96.5% |
┌────────────────────────────────────────────────────────┐
│ OpenAI Whisper-Medium │
│ (4-bit NF4 Quantization Base) │
│ (763.86M Frozen Params) │
└──────────────────────────┬─────────────────────────────┘
│
┌─────────────┴─────────────┐
│ LoRA Adapters (r=64) │
│ Target: q, k, v, out, │
│ fc1, fc2 │
│ (69.21M Trainable) │
└─────────────┬─────────────┘
│
┌────────────────────┴────────────────────┐
│ Sequential Curriculum Learning │
├─────────────────────────────────────────┤
│ Phase 1: Kahwa Podcast (Conversational) │
│ ▼ │
│ Phase 2: Loubna Stories (Expressive) │
│ ▼ │
│ Phase 3: Rawi Narratives (Storytelling) │
└─────────────────────────────────────────┘
openai/whisper-medium (Encoder-Decoder Transformer, 24 encoder layers, 24 decoder layers, 16 attention heads)641280.05q_proj, k_proj, v_proj, out_proj, fc1, fc2nonebitsandbytes)[French: ...], [FR: ...][...], <...>\u064B to \u0652, \u0670\u0640إ, أ, آ $\rightarrow$ اى $\rightarrow$ ي،, ؛, ؟, «, »).pip install --upgrade transformers peft torch torchaudio soundfile librosa jiwer bitsandbytes accelerate
transformers.pipelineimport torch
from transformers import pipeline
# Initialize speech recognition pipeline with PEFT adapter
pipe = pipeline(
task="automatic-speech-recognition",
model="touati-kamel/whisper-algerian-darja-medium",
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device=0 if torch.cuda.is_available() else "cpu",
chunk_length_s=30,
)
# Transcribe an audio file (16kHz WAV or MP3)
result = pipe(
"path/to/algerian_audio.mp3",
generate_kwargs={"language": "arabic", "task": "transcribe"}
)
print("Transcription (Darja):", result["text"])
PeftModel Inferenceimport torch
import librosa
from transformers import WhisperProcessor, WhisperForConditionalGeneration
from peft import PeftModel
device = "cuda" if torch.cuda.is_available() else "cpu"
model_id = "openai/whisper-medium"
adapter_id = "touati-kamel/whisper-algerian-darja-medium"
# 1. Load Processor
processor = WhisperProcessor.from_pretrained(model_id, language="arabic", task="transcribe")
# 2. Load Base Model and Apply LoRA Adapter
base_model = WhisperForConditionalGeneration.from_pretrained(
model_id,
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
device_map="auto" if torch.cuda.is_available() else None,
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
# 3. Load and Preprocess Audio
audio, sr = librosa.load("path/to/audio.mp3", sr=16000)
input_features = processor(audio, sampling_rate=16000, return_tensors="pt").input_features
if torch.cuda.is_available():
input_features = input_features.to("cuda", dtype=torch.float16)
# 4. Generate Transcription
forced_decoder_ids = processor.get_decoder_prompt_ids(language="arabic", task="transcribe")
with torch.no_grad():
predicted_ids = model.generate(
input_features,
forced_decoder_ids=forced_decoder_ids,
max_new_tokens=225
)
# 5. Decode Output
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
print("Algerian Darja Output:", transcription)
To align with the training evaluation standard, use the following text normalizer:
import re
import string
_ARABIC_DIACRITICS = "\u064B\u064C\u064D\u064E\u064F\u0650\u0651\u0652\u0670"
_TATWEEL = "\u0640"
_PUNCT_MAP = {ord(c): None for c in string.punctuation + "\u060C\u061B\u061F\u00AB\u00BB"}
def normalize_darja_text(text: str) -> str:
if not text:
return ""
# Strip diacritics & tatweel
text = text.translate({ord(c): None for c in _ARABIC_DIACRITICS})
text = text.replace(_TATWEEL, "")
# Normalize Alef and Yaa
text = text.replace("\u0625", "\u0627").replace("\u0623", "\u0627").replace("\u0622", "\u0627")
text = text.replace("\u0649", "\u064A")
# Remove punctuation
text = text.translate(_PUNCT_MAP)
# Collapse whitespace
return " ".join(text.split()).strip()
Evaluates Zero-Shot foundation Whisper vs. Fine-Tuned models on UBC-NLP/Casablanca (Algeria test split, 843 authentic dialectal utterances):
| Model Configuration | Normalized WER (%) | Normalized CER (%) | Rel. Error Reduction |
|---|---|---|---|
| Vanilla Whisper Small (Zero-Shot) | 135.97% | 56.88% | — |
| Fine-Tuned Whisper Small (OddAdmix) | 77.19% | 34.78% | -43.23% |
| Vanilla Whisper Medium (Zero-Shot) | 111.75% | 49.80% | — |
| Fine-Tuned Whisper Medium (OddAdmix) | 74.98% | 31.30% | -32.90% |
dz)Evaluates Zero-Shot foundation Whisper vs. Fine-Tuned models on the Algerian partition of oddadmix/yodas-v3-ar-labeled-split (split dz, 3,000 utterances / 14.31 audio hours across 1,552 distinct video recordings):
| Model Configuration | Normalized WER (%) | Normalized CER (%) | Raw WER (%) | Rel. Error Reduction |
|---|---|---|---|---|
| Vanilla Whisper Small (Zero-Shot) | 177.36% | 145.45% | 180.34% | — |
| Fine-Tuned Whisper Small (OddAdmix) | 172.61% | 130.28% | 173.31% | -2.68% |
| Vanilla Whisper Medium (Zero-Shot) | 155.53% | 130.28% | 160.18% | — |
| Fine-Tuned Whisper Medium (OddAdmix) | 143.56% | 104.68% | 144.51% | -7.70% |
| Hyperparameter | Value |
|---|---|
| Base Model | openai/whisper-medium (769M params) |
| Quantization | 4-bit NF4 (BitsAndBytesConfig) |
| Hardware | 1x NVIDIA Tesla T4 GPU (16 GB VRAM) |
| Per-Device Batch Size | 4 |
| Gradient Accumulation Steps | 8 (Effective Batch Size = 32) |
| Mixed Precision | FP16 (fp16=True) |
| Gradient Checkpointing | Enabled (gradient_checkpointing=True) |
| Optimizer | AdamW |
| Learning Rate Schedule | Cosine Annealing with Warmup |
| Warmup Steps | 100 (Phase 1), 50 (Phase 2), 30 (Phase 3) |
| Evaluation Strategy | Every 300 steps with WER computation |
| Checkpoint Strategy | Automatic Best WER saving + Hugging Face Hub upload |
@misc{touati2026whisper_algerian_darja_medium,
author = {Kamel Touati},
title = {Whisper Medium Fine-Tuned for Algerian Arabic (Darja)},
year = {2026},
publisher = {Hugging Face},
journal = {Hugging Face Hub},
howpublished = {\url{https://huggingface.co/touati-kamel/whisper-algerian-darja-medium}}
}
@article{radford2022whisper,
title={Robust Speech Recognition via Large-Scale Weak Supervision},
author={Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
journal={arXiv preprint arXiv:2212.04356},
year={2022}
}