🇲🇦 HADRA (هضرة) — Habibi-TTS Moroccan Darija
🌟 Overview
Jip7e/habibi-tts-doda-darija (also known as HADRA / هضرة) is an open-source speech synthesis model fine-tuned specifically for Moroccan Darija (الدارجة المغربية).
Unlike autoregressive language models that suffer from token looping, hallucinated pauses, and phonetic collapse on dialectal Arabic, this model uses a non-autoregressive Flow-Matching Diffusion Transformer (DiT) backbone. It generates 24 kHz studio-quality Moroccan speech with authentic cadence, natural prosody, and razor-sharp zero-shot voice cloning.
- Live Demo & Voice Playground: https://hadra-seven.vercel.app/
- Base Architecture: F5-TTS DiT Backbone (22 layers, 1024-dim, 16 heads, 336M parameters)
- Vocoder: Vocos 24 kHz Mel-Vocoder (
charactr/vocos-mel-24khz) - Training Dataset: 12,105 studio clips from
Jip7e/doda-darija-cosyvoice2 - Speakers: 7 Balanced Native Moroccan Personas (4 Female, 3 Male)
- Available Formats:
model_ema.safetensors(1.3 GB - Recommended): Lightweight, pure EMA weights for low-latency production inference and serverless deployment.model_last.pt(5.4 GB): Full checkpoint containing model, EMA, and optimizer states.
🏛️ The Three-Tier Architecture
To balance studio-grade acoustic fidelity with sub-second real-time conversational agents, HADRA implements a coordinated three-tier routing system:
- ⚡ Tier 0: 0ms Pre-Synthesized Opus Store: 24 high-frequency Moroccan greetings, affirmations, and filler phrases pre-computed at NFE=32 with fuzzy matching (RapidFuzz ratio ≥ 90%) for 0.01ms response time.
- 🎙️ Tier 1: F5-TTS DiT Quality Engine: Flow-matching DiT with Sway Sampling (
sway_sampling_coef = -1.0) and Truncated CFG for custom sentences, studio voiceovers, and longform narrative reading. - 🚀 Tier 2: Realtime Piper VITS ONNX (In Progress): Single-pass feedforward ONNX model (RTF < 0.05, 30ms latency) dedicated to live Voice-to-Voice conversational turns on CPU.
🎙️ Golden Reference Prompts for the 7 Speakers
F5-TTS is conditioned by inpainting directly on the mel-spectrogram canvas. Using a clean 3–6s reference audio with a 100% verbatim transcript ensures stable pitch, crisp consonants (ح, خ, ق, ع), and zero phoneme skipping.
Here are the curated golden prompts from the DODa dataset:
| Speaker ID | Persona | Tone | Golden Reference Transcript | Clip Duration |
|---|---|---|---|---|
F1 | Salma (سلمى) | Warm & Natural | هوما مخبيين شي حاجة انا متيقن | 2.71s |
F2 | Yasmine (ياسمين) | Calm & Narrative | غادي خاصنا نحافضو على الطاقة ديالنا على قبل الطلعة والنزلة | 5.38s |
F3 | Kenza (كنزة) | Energetic & Crisp | نستافدو من المدينة وداكشي لي تقدر تعطي | 4.32s |
F4 | Fatima (فاطمة) | Resonant & Wise | واش كاتشرب أتاي بلا السكر | 3.22s |
M1 | Amine (أمين) | Conversational & Modern | يمكن ما كيعجبكش الطيران من هادشي كلو | 3.82s |
M2 | Mehdi (مهدي) | Deep & Narrative | واخا والمشروبات اش نديرو فيهم | 3.73s |
M3 | Yassine (ياسين) | Friendly & Casual | يبان ليا غايجينا جواب اسرع من الناس لي فالاستقبال | 4.74s |
🚀 Quickstart & Inference
1. Installation
git clone https://github.com/SWivid/F5-TTS.git
cd F5-TTS
pip install -e .
pip install soundfile huggingface_hub vocos accelerate safetensors
2. Python Inference (With Sway Sampling & AMX Acceleration)
import soundfile as sf
import torch
from huggingface_hub import hf_hub_download
from f5_tts.infer.utils_infer import load_model, load_vocoder, preprocess_ref_audio_text, infer_process
from f5_tts.model import DiT
# 1. Download Model & Vocab
REPO_ID = "Jip7e/habibi-tts-doda-darija"
ckpt_path = hf_hub_download(repo_id=REPO_ID, filename="model_ema.safetensors")
vocab_path = hf_hub_download(repo_id=REPO_ID, filename="vocab.txt")
# 2. Load Model & Vocos Vocoder
cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4)
model = load_model(DiT, cfg, ckpt_path, vocab_file=vocab_path)
vocoder = load_vocoder("vocos")
# 3. Reference Speaker Audio (e.g. Salma F1)
ref_audio = "path/to/F1.wav"
ref_text = "هوما مخبيين شي حاجة انا متيقن"
# 4. Target Text in Moroccan Darija
target_text = "السلام عليكم ورحمة الله! تبارك الله عليك، هاد النموذج دالذكاء الاصطناعي المغربي ناضي بزاف."
# 5. Synthesize with Sway Sampling (NFE=16 for speed + studio quality)
ra, rt = preprocess_ref_audio_text(ref_audio, ref_text)
with torch.autocast(device_type="cpu" if not torch.cuda.is_available() else "cuda", dtype=torch.bfloat16):
wav, sr, _ = infer_process(
ra,
rt,
target_text,
model,
vocoder,
speed=0.95,
nfe_step=16,
cfg_strength=2.0,
sway_sampling_coef=-1.0
)
sf.write("output_darija.wav", wav, sr)
print("✅ Saved output_darija.wav!")
⚙️ Recommended Inference Hyperparameters
| Parameter | Recommended Value | Description |
|---|---|---|
nfe_step | 16 (Speed) / 32 (Studio Master) | ODE flow-matching steps. Combined with Sway Sampling, NFE 16 achieves ~95% of NFE 32 fidelity. |
sway_sampling_coef | -1.0 | Front-loads integration steps early where trajectory curves most. |
cfg_strength | 1.8 – 2.0 | Classifier-Free Guidance for strict character alignment. |
speed | 0.90 – 0.95 | Authentic Moroccan conversational cadence. |
ref_audio duration | 3.5 – 6.0s | Optimal prompt window. Trim leading/trailing silence to <50ms. |
📊 Training Details & Benchmarks
- Hardware: 2x NVIDIA Tesla T4 GPUs (PyTorch DDP via Accelerate).
- Epochs: 12 Full Epochs (984 optimizer steps, Batch size: 3200 frames/GPU, Grad Acc: 6).
- Optimizer: AdamW (
lr = 1e-5, cosine decay with 500 warmup steps). - Final Loss:
0.59(smooth monotonic convergence from2.84). - CPU Inference Benchmarks (Intel Xeon Platinum Sapphire Rapids AMX-BF16):
- NFE 8: RTF 2.65 (~11s)
- NFE 16 + Sway (-1.0): RTF 3.40 (~14s) — Recommended Sweet Spot
- NFE 32: RTF 10.60 (~44s)
- 0ms Cache: RTF 0.00 (0.01ms)
📜 Citation
@misc{hadra_darija_tts_2026,
title={HADRA: Open-Source Moroccan Darija Flow-Matching Voice Model},
author={Hadra Open Initiative and Contributing Medical Student},
year={2026},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/Jip7e/habibi-tts-doda-darija}},
note={Fine-tuned on DODa Moroccan Arabic Dataset (12,105 Studio Utterances)}
}
🙏 Acknowledgements
- AtlasIA DODa Team: For creating and open-sourcing the foundational Moroccan Darija speech corpus.
- SWivid / F5-TTS Team: For the non-autoregressive Flow Matching DiT architecture.
- Habibi-TTS Authors: For the dialectal Arabic foundation models.