Whisper Small - Urdu Fine-tuned
This model is a fine-tuned version of
openai/whisper-small for
Urdu (اردو) automatic speech recognition (ASR), trained on the expanded
Mozilla Common Voice Scripted Speech 24.0 - Urdu dataset, accessed via the Mozilla Data Collective API.
Model Description
Developed by: Khawaja Ali
Model type: Whisper (Encoder-Decoder Transformer)
Language: Urdu (ur)
License: Apache 2.0
Finetuned from: openai/whisper-small
Best Checkpoint: Step 3500 (loaded via load_best_model_at_end)
W&B Run: whisper-small-urdu-expanded-v1
Intended Uses & Limitations
Intended Uses
Transcribing Urdu speech to text
Building Urdu voice assistants
Subtitling Urdu audio/video content
Accessibility applications for Urdu speakers
Limitations
Domain: Trained on read speech; may underperform on conversational/spontaneous speech
Accents: Primarily trained on Common Voice contributors; dialect coverage may vary
Noise: Best performance on clean audio; background noise degrades accuracy
Audio format: Requires 16kHz mono audio
Performance
Dataset WER ↓ Improvement Common Voice Urdu (validation) 32.80% -13.4pp vs baseline Common Voice Urdu (test) ~33% ~13pp improvement
Baseline Comparison (Base Models, Zero-Shot on Urdu):
Model Parameters WER (Urdu) Notes whisper-tiny 39M ~65% Zero-shot whisper-small 244M 46.21% Zero-shot (our baseline) whisper-small-urdu (this) 244M 32.80% Fine-tuned ✨ (29% relative improvement) whisper-medium 769M ~40% Zero-shot whisper-large-v2 1.5B ~35% Zero-shot
🎉 This fine-tuned small model outperforms whisper-medium and approaches whisper-large-v2 performance!
Quick Start
Installation
pip install transformers torch librosa
Inference with Pipeline (Recommended)
1 from transformers import pipeline
2 import torch
3
4 device = "cuda:0" if torch . cuda . is_available ( ) else "cpu"
5
6 pipe = pipeline (
7 "automatic-speech-recognition" ,
8 model = "khawajaaliarshad/whisper-small-urdu" ,
9 device = device ,
10 )
11
12 # Transcribe audio file
13 result = pipe (
14 "audio.wav" ,
15 generate_kwargs = { "language" : "urdu" , "task" : "transcribe" } ,
16 )
17 print ( result [ "text" ] )
Inference with Transformers
1 from transformers import WhisperProcessor , WhisperForConditionalGeneration
2 import torch
3 import librosa
4
5 # Load model
6 processor = WhisperProcessor . from_pretrained ( "khawajaaliarshad/whisper-small-urdu" )
7 model = WhisperForConditionalGeneration . from_pretrained ( "khawajaaliarshad/whisper-small-urdu" )
8
9 device = "cuda:0" if torch . cuda . is_available ( ) else "cpu"
10 model . to ( device )
11
12 # Load and process audio
13 audio , sr = librosa . load ( "audio.wav" , sr = 16000 )
14 inputs = processor ( audio , sampling_rate = 16000 , return_tensors = "pt" ) . to ( device )
15
16 # Generate transcription
17 with torch . no_grad ( ) :
18 predicted_ids = model . generate (
19 inputs . input_features ,
20 language = "urdu" ,
21 task = "transcribe" ,
22 max_length = 225 ,
23 )
24
25 # Decode
26 transcription = processor . batch_decode ( predicted_ids , skip_special_tokens = True ) [ 0 ]
27 print ( transcription )
Long-form Transcription
For audio longer than 30 seconds:
1 result = pipe (
2 "long_audio.wav" ,
3 chunk_length_s = 30 ,
4 batch_size = 8 ,
5 generate_kwargs = { "language" : "urdu" , "task" : "transcribe" } ,
6 )
7 print ( result [ "text" ] )
Training Details
Training Data
The model was trained on the
expanded Common Voice Scripted Speech 24.0 - Urdu dataset downloaded via the
Mozilla Data Collective API .
Property Value Dataset Common Voice Scripted Speech 24.0 - Urdu (Expanded) Source Mozilla Data Collective Dataset ID cmj8u3pz600t9nxxbz9l2ck2nLicense CC0-1.0 (Public Domain) Total Raw Samples 252,899 Total Raw Hours 302 hours (81.5 validated) Speakers 498
Processed splits used for training (expanded):
Split Samples Hours (approx) Train 54,754 ~75 hrs Validation 5,046 ~7 hrs Test 5,091 ~7 hrs Total 64,891 ~89 hrs
This is the preprocessed version of the dataset used for training, with audio resampled to 16kHz and ready for Whisper fine-tuning.
Note: The model was trained on clean (non-augmented) data . Initial experiments with audio augmentation showed degraded performance due to train/eval domain mismatch.
Training Hyperparameters
Parameter Value Base model openai/whisper-smallLearning rate 1e-5 LR scheduler Linear with warmup Warmup steps 500 Training steps 4,000 Epochs completed ~1.17 Batch size (per device) 4 Gradient accumulation 4 Effective batch size 16 Precision FP16 Optimizer AdamW Adam betas (0.9, 0.98) Weight decay 0.01 Max gradient norm 1.0 Metric for best model WER
Training Infrastructure
Training Progress
Checkpoint Train Loss Eval Loss Eval WER Step 500 0.4914 0.6362 46.07% Step 1000 0.4165 0.5556 59.80% Step 1500 0.3500 0.5173 56.53% Step 2000 0.2952 0.4894 33.10% Step 2500 0.2882 0.4731 54.97% Step 3000 0.2560 0.4562 53.87% Step 3500 0.1858 0.4478 32.80% ✨Step 4000 0.1708 0.4449 38.17%
Note: Best WER was achieved at step 3500 (32.80%). The model loaded via load_best_model_at_end=True uses this checkpoint.
Framework Versions
Python: 3.12
Transformers: 4.52.0
Datasets: 2.20.0
PyTorch: 2.8.0
Accelerate: 0.30+
Evaluation
Metrics
WER (Word Error Rate): Primary metric for ASR evaluation
Computed using jiwer library
Evaluation Code
1 from datasets import load_dataset
2 from transformers import pipeline
3 from evaluate import load
4
5 # Load test data
6 test_ds = load_dataset ( "mozilla-foundation/common_voice_17_0" , "ur" , split = "test" )
7
8 # Load model
9 pipe = pipeline ( "automatic-speech-recognition" , model = "khawajaaliarshad/whisper-small-urdu" )
10
11 # Run evaluation
12 wer_metric = load ( "wer" )
13 predictions , references = [ ] , [ ]
14
15 for sample in test_ds :
16 result = pipe ( sample [ "audio" ] [ "array" ] , generate_kwargs = { "language" : "urdu" } )
17 predictions . append ( result [ "text" ] )
18 references . append ( sample [ "sentence" ] )
19
20 wer = wer_metric . compute ( predictions = predictions , references = references )
21 print ( f"WER: { wer * 100 : .2f } %" )
Environmental Impact
Training was performed on Kaggle's free GPU tier, utilizing shared infrastructure.
Factor Value Hardware NVIDIA T4 Training duration ~6.3 hours Cloud provider Kaggle (Google Cloud) Region Various Carbon efficiency Shared infrastructure
Citation
BibTeX
If you use this model in your research, please cite:
1 @misc{khawaja2025whisperurdu,
2 author = {Khawaja, Ali},
3 title = {Whisper Small Fine-tuned for Urdu Speech Recognition},
4 year = {2025},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/khawajaaliarshad/whisper-small-urdu}},
7 }
Please also cite the original Whisper paper:
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 }
And the Mozilla Common Voice dataset:
1 @inproceedings{ardila2020common,
2 title={Common Voice: A Massively-Multilingual Speech Corpus},
3 author={Ardila, Rosana and Branson, Megan and Davis, Kelly and Henretty, Michael and Kohler, Michael and Meyer, Josh and Morais, Reuben and Saunders, Lindsay and Tyers, Francis M and Weber, Gregor},
4 booktitle={Proceedings of the 12th Language Resources and Evaluation Conference},
5 pages={4211--4215},
6 year={2020}
7 }
Data Access: The Urdu dataset was accessed via the
Mozilla Data Collective API (Dataset ID:
cmj8u3pz600t9nxxbz9l2ck2n). The data is licensed under CC0-1.0 (Public Domain).
Acknowledgments
This project was made possible by the following resources and communities:
Models & Data
OpenAI Whisper - For the foundational multilingual speech recognition model
Mozilla Common Voice - For the open-source Urdu speech dataset contributed by volunteers worldwide
Mozilla Data Collective - For the API access to download Common Voice datasets
Mozilla Foundation - For supporting open speech data initiatives
Hugging Face - For the transformers library and model hosting infrastructure
Compute & Tools
Kaggle - For providing free GPU compute (T4)
Weights & Biases - For experiment tracking and visualization
Google Colab - For initial experimentation
Libraries
🤗 Transformers
🤗 Datasets
🤗 Evaluate
🤗 Accelerate
jiwer - WER computation
librosa - Audio processing
Community
The Urdu-speaking contributors to Mozilla Common Voice
The Hugging Face community for guidance on Whisper fine-tuning
The open-source ML community
Model Card Authors
Contact
For questions, issues, or collaboration:
🐛 Issues: Open an issue on the model repository
💬 Discussion: Use the Community tab on HuggingFace
Made with ❤️ for the Urdu-speaking community