Views
No views yet

touati-kamel/whisper-algerian-darja-small is an Automatic Speech Recognition (ASR) model specifically fine-tuned for Algerian Arabic (Darja / الدارجة الجزائرية).openai/whisper-small, 244M parameters), this model incorporates parameter-efficient LoRA adapters trained with 4-bit quantization (QLoRA) over a sequential 3-phase curriculum covering conversational podcasts, spontaneous storytelling, and cultural narratives from the OddAdmix Algerian speech collection.| 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 (4,942 steps) | $1 \times 10^{-4}$ | 34.85% | 0.521 |
| Phase 2 | Loubna Stories (oddadmix/arabic-audio-collection-algerian-loubna-stories) | 2 epochs (10,324 steps) | $5 \times 10^{-5}$ | 14.87% | 0.312 |
| Phase 3 | Rawi Storytelling (oddadmix/arabic-audio-collection-algerian-rawi) | 1 epoch (562 steps) | $2 \times 10^{-5}$ | 27.54% | 0.2548 |
Cumulative Training Progress: Total training ran for 15,829 cumulative optimization steps with cosine annealing learning rate schedules and automatic best-adapter preservation per phase.
┌────────────────────────────────────────────────────────┐
│ OpenAI Whisper-Small │
│ (4-bit NF4 Quantization Base) │
└──────────────────────────┬─────────────────────────────┘
│
┌─────────────┴─────────────┐
│ LoRA Adapters (r=64) │
│ Target: q, k, v, out, │
│ fc1, fc2 │
└─────────────┬─────────────┘
│
┌────────────────────┴────────────────────┐
│ Sequential Curriculum Learning │
├─────────────────────────────────────────┤
│ Phase 1: Kahwa Podcast (Conversational) │
│ ▼ │
│ Phase 2: Loubna Stories (Expressive) │
│ ▼ │
│ Phase 3: Rawi Narratives (Storytelling) │
└─────────────────────────────────────────┘openai/whisper-small (Encoder-Decoder Transformer)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 jiwertransformers.pipeline1import torch
2from transformers import pipeline
3
4# Initialize speech recognition pipeline with PEFT adapter
5pipe = pipeline(
6 task="automatic-speech-recognition",
7 model="touati-kamel/whisper-algerian-darja-small",
8 torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
9 device=0 if torch.cuda.is_available() else "cpu",
10 chunk_length_s=30,
11)
12
13# Transcribe an audio file (16kHz WAV or MP3)
14result = pipe(
15 "path/to/algerian_audio.mp3",
16 generate_kwargs={"language": "arabic", "task": "transcribe"}
17)
18
19print("Transcription (Darja):", result["text"])PeftModel Inference1import torch
2import librosa
3from transformers import WhisperProcessor, WhisperForConditionalGeneration
4from peft import PeftModel
5
6device = "cuda" if torch.cuda.is_available() else "cpu"
7model_id = "openai/whisper-small"
8adapter_id = "touati-kamel/whisper-algerian-darja-small"
9
10# 1. Load Processor
11processor = WhisperProcessor.from_pretrained(model_id, language="arabic", task="transcribe")
12
13# 2. Load Base Model and Apply LoRA Adapter
14base_model = WhisperForConditionalGeneration.from_pretrained(
15 model_id,
16 torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
17 device_map="auto" if torch.cuda.is_available() else None,
18)
19model = PeftModel.from_pretrained(base_model, adapter_id)
20model.eval()
21
22# 3. Load and Preprocess Audio
23audio, sr = librosa.load("path/to/audio.mp3", sr=16000)
24input_features = processor(audio, sampling_rate=16000, return_tensors="pt").input_features
25if torch.cuda.is_available():
26 input_features = input_features.to("cuda", dtype=torch.float16)
27
28# 4. Generate Transcription
29forced_decoder_ids = processor.get_decoder_prompt_ids(language="arabic", task="transcribe")
30with torch.no_grad():
31 predicted_ids = model.generate(
32 input_features,
33 forced_decoder_ids=forced_decoder_ids,
34 max_new_tokens=225
35 )
36
37# 5. Decode Output
38transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
39print("Algerian Darja Output:", transcription)1import re
2import string
3
4_ARABIC_DIACRITICS = "\u064B\u064C\u064D\u064E\u064F\u0650\u0651\u0652\u0670"
5_TATWEEL = "\u0640"
6_PUNCT_MAP = {ord(c): None for c in string.punctuation + "\u060C\u061B\u061F\u00AB\u00BB"}
7
8def normalize_darja_text(text: str) -> str:
9 if not text:
10 return ""
11 # Strip diacritics & tatweel
12 text = text.translate({ord(c): None for c in _ARABIC_DIACRITICS})
13 text = text.replace(_TATWEEL, "")
14 # Normalize Alef and Yaa
15 text = text.replace("\u0625", "\u0627").replace("\u0623", "\u0627").replace("\u0622", "\u0627")
16 text = text.replace("\u0649", "\u064A")
17 # Remove punctuation
18 text = text.translate(_PUNCT_MAP)
19 # Collapse whitespace
20 return " ".join(text.split()).strip()| Hyperparameter | Value |
|---|---|
| Base Model | openai/whisper-small (244M params) |
| Quantization | 4-bit NF4 (BitsAndBytesConfig) |
| Hardware | 1x NVIDIA Tesla T4 GPU (16 GB VRAM) |
| Per-Device Batch Size | 8 |
| Gradient Accumulation Steps | 4 (Effective Batch Size = 32) |
| Mixed Precision | FP16 (fp16=True) |
| Gradient Checkpointing | Enabled |
| 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 |
1@misc{touati2026whisper_algerian_darja,
2 author = {Kamel Touati},
3 title = {Whisper Small Fine-Tuned for Algerian Arabic (Darja)},
4 year = {2026},
5 publisher = {Hugging Face},
6 journal = {Hugging Face Hub},
7 howpublished = {\url{https://huggingface.co/touati-kamel/whisper-algerian-darja-small}}
8}1@article{radford2022whisper,
2 title={Robust Speech Recognition via Large-Scale Weak Supervision},
3 author={Radford, Alec and Kim, Jong Wook and Xu, Tao and Brockman, Greg and McLeavey, Christine and Sutskever, Ilya},
4 journal={arXiv preprint arXiv:2212.04356},
5 year={2022}
6}