Views
No views yet
openai/whisper-small on Perso-Arabic script audio data.docs/Engineering Case Study.md.1import torch
2import soundfile as sf
3from transformers import WhisperForConditionalGeneration, WhisperProcessor
4
5device = "cuda" if torch.cuda.is_available() else "cpu"
6repo = "YuvrajGujari/whisper-small-balti"
7
8processor = WhisperProcessor.from_pretrained(repo)
9model = WhisperForConditionalGeneration.from_pretrained(repo).to(device)
10
11audio, _ = sf.read("balti_sample.wav")
12inputs = processor(audio, sampling_rate=16000, return_tensors="pt").input_features.to(device)
13
14with torch.no_grad():
15 predicted_ids = model.generate(inputs, forced_decoder_ids=None)
16
17text = processor.batch_decode(predicted_ids, skip_special_tokens=True)[0]
18print("Transcription:", text)
19
20### 📊 Benchmark Comparison
21
22| Model | Setup | Strategy | Validation WER |
23| --- | --- | --- | --- |
24| **Whisper-small (Champion)** 🏆 | **Cold-Start** | **SpecAugment + $1\times 10^{-4}$ LR** | **17.40%** |
25| Wav2Vec2 XLS-R 300M | Cold-Start | Standard CTC | 22.82% |
26| *BaltiVoice Literature* | — | Published Baseline | *26.74%* |
27| Whisper-small (Round 2) | Warm-Start | Standard Fine-Tuning ($1\times 10^{-5}$ LR) | 36.38% |
28| Whisper-small (Base) | Zero-Shot | Out-of-the-Box | 63.42% |
29
30---
31
32### 📈 Training Step Log
33
34| Step | Training Loss | Validation Loss | Validation WER |
35| --- | --- | --- | --- |
36| 500 | 0.9031 | 0.3995 | 39.72% |
37| 1000 | 0.5979 | 0.3019 | 29.23% |
38| 1500 | 0.3326 | 0.2518 | 23.81% |
39| 2000 | 0.1582 | 0.2235 | 20.27% |
40| **2500** | **0.0609** | **0.2142** | **17.40%** |
41
42🛠️ Key Training Highlights
43Cold-Start Fine-Tuning: Reset weights to base openai/whisper-small to avoid local minima.
44
45SpecAugment: Applied time and frequency masking (prob=0.05) to prevent overfitting.
46
47LR & Schedule: Trained for 2,500 steps with lr=1e-4 and 500 warmup steps.