Model Selection
| Model | Params | WER (EN) | Speed |
|---|---|---|---|
| tiny | 39M | 14% | 32x |
| base | 74M | 10% | 16x |
| small | 244M | 7% | 6x |
| medium | 769M | 5% | 2x |
| large-v3 | 1.5B | 3% | 1x |
For production with latency constraints: small is the sweet spot.
FastAPI Deployment
import whisper
from fastapi import FastAPI, UploadFile
app = FastAPI()
model = whisper.load_model('small').to('cuda')
@app.post('/transcribe')
async def transcribe(audio: UploadFile, language: str = 'ar'):
audio_bytes = await audio.read()
result = model.transcribe(audio_bytes, language=language, fp16=True)
return {'text': result['text'], 'language': result['language']}
Darija Fine-Tuning Dataset
Used Mozilla Common Voice Arabic + scraped Moroccan radio recordings. Fine-tuning for 3 epochs reduces WER from 32% to 18% on Darija.