# Qwen3-ASR Fine-Tuning for Moroccan Darija
Fine-tune Qwen3-ASR on the MoulSot-Full dataset — a curated corpus of Moroccan Darija speech.
Based on the MoulSot project, which built a full pipeline crawling ~1,500 hours from YouTube and transcribing 80 hours using Gemini 2.5 Pro.
---
## Project Structure
```
qwen3_asr_darija/
├── config.py # All paths and hyperparameters
├── check_env.py # Verify GPU and installed packages
├── prepare_data.py # Download dataset and build JSONL manifests
├── train.py # Fine-tune using the official Qwen3-ASR SFT script
├── evaluate.py # Evaluate a checkpoint with WER / CER / RTF
├── infer.py # Transcribe new audio files
└── requirements.txt
```
---
## Requirements
- Python 3.10+
- CUDA-capable GPU (16 GB VRAM recommended; T4 works for the default config)
- Git
Install Python dependencies:
```bash
pip install -r requirements.txt
```
---
## Quick Start
### 1. Check your environment
```bash
python check_env.py
```
### 2. Prepare the data
Downloads MoulSot-Full from Hugging Face, resamples audio to 16 kHz, and writes JSONL manifests.
```bash
python prepare_data.py
```
By default this uses **1,000 training** and **200 test** samples. Edit `config.py` to change these values.
### 3. Fine-tune the model
```bash
python train.py
```
This will:
1. Clone the official `QwenLM/Qwen3-ASR` repository.
2. Apply the fp16 compatibility patch.
3. Launch the SFT training script.
Checkpoints are saved to `model_output/`.
### 4. Evaluate
```bash
python evaluate.py
```
Optional arguments:
```bash
python evaluate.py --checkpoint model_output/checkpoint-250 --samples 100
```
Reports WER, CER, and mean RTF. Per-sample results are saved to `data/eval_details.tsv`.
### 5. Transcribe new audio
```bash
python infer.py path/to/audio.wav
python infer.py audio1.wav audio2.wav --checkpoint model_output/checkpoint-250
```
---
## Configuration
All settings live in `config.py`. Common things to cha …