File size: 6,093 Bytes
51ceae2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2b60261
51ceae2
aee6c4c
51ceae2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91c21d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51ceae2
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
base_model: openai/whisper-large-v3
base_model_relation: adapter
library_name: peft
pipeline_tag: automatic-speech-recognition
language:
  - hi
  - en
  - bn
datasets:
  - dianavdavidson/MUCS-Hinglish
  - tiny-aya-translate/hinglish-casual
  - addyo07/noisy-hinglish-asr
  - niloycste68/Bangali_local_dialect_ASR_HF_Dataset
tags:
  - whisper
  - lora
  - code-switching
  - hinglish
  - safetensors
metrics:
  - wer
  - cer
model-index:
  - name: Whisper Large V3 Code-Switch LoRA
    results:
      - task:
          type: automatic-speech-recognition
        dataset:
          name: MUCS Hinglish test subset (21 clips)
          type: dianavdavidson/MUCS-Hinglish
          split: test
        metrics:
          - name: Word error rate (%)
            type: wer
            value: 45.57
          - name: Character error rate (%)
            type: cer
            value: 33.46
---

# Whisper Large V3 Code-Switch LoRA

A PEFT LoRA adapter for automatic speech recognition on code-switched speech. It was trained on Hindi–English and Bengali data with [OpenAI Whisper Large V3](https://huggingface.co/openai/whisper-large-v3) as the base. Load the adapter alongside that base checkpoint.

The release contains the final adapter from version 2 of the training run, saved after step 1,524. Training used LoRA rank 16, alpha 32, dropout 0.05, and the query and value projections as targets. The training job's built-in evaluation hit an FP16 input dtype mismatch after the final weights were saved. The scores below come from a separate CPU evaluation of those saved weights.

## Usage

Install PyTorch, `transformers==4.51.3`, `peft==0.15.2`, and `soundfile`. The example expects a mono, 16 kHz WAV of up to 30 seconds. Authenticate with Hugging Face to access the private adapter.

```python
import soundfile as sf
import torch
from peft import PeftModel
from transformers import WhisperForConditionalGeneration, WhisperProcessor

base_id = "openai/whisper-large-v3"
adapter_id = "GL3MON/whisper-large-v3-code-switch-lora"

processor = WhisperProcessor.from_pretrained(base_id)
base = WhisperForConditionalGeneration.from_pretrained(base_id, torch_dtype=torch.float32)
model = PeftModel.from_pretrained(base, adapter_id).eval()

audio, rate = sf.read("utterance.wav", dtype="float32")
if rate != 16_000 or audio.ndim != 1 or not 0 < len(audio) <= 30 * rate:
    raise ValueError("Use a mono 16 kHz WAV of up to 30 seconds")

features = processor.feature_extractor(
    audio, sampling_rate=rate, return_tensors="pt", return_attention_mask=True
)
with torch.inference_mode():
    tokens = model.generate(
        **features, language="hi", task="transcribe",
        num_beams=1, do_sample=False, max_new_tokens=128,
    )
print(processor.batch_decode(tokens, skip_special_tokens=True)[0])
```

## Training data

| Source | Training clips | Held back during training |
|---|---:|---:|
| MUCS Hinglish | 512 | 24 |
| Hinglish Casual | 512 | 0 |
| Noisy Hinglish ASR | 419 | 24 |
| Bangali Local Dialect ASR | 140 | 24 |
| Total | 1,583 | 72 |

Source dataset cards document collection methods and terms. [MUCS Hinglish](https://huggingface.co/datasets/dianavdavidson/MUCS-Hinglish) · [Hinglish Casual](https://huggingface.co/datasets/tiny-aya-translate/hinglish-casual) · [Noisy Hinglish ASR](https://huggingface.co/datasets/addyo07/noisy-hinglish-asr) · [Bangali Local Dialect ASR](https://huggingface.co/datasets/niloycste68/Bangali_local_dialect_ASR_HF_Dataset)

## Independent evaluation

The sample contains 21 clips from 21 speakers in the official MUCS Hinglish test split, covering 166.3 seconds and 305 reference words. Starting at each 150th row, the evaluation selected the first clip among the next 24 rows with 6–32 reference words and both English and Devanagari words. Both models used CPU BF16, a Hindi language hint, greedy decoding, and up to 128 new tokens. Scoring applied Unicode NFC, case folding, punctuation replacement with spaces, and whitespace normalization while preserving script and diacritics. [MUCS Hinglish dataset](https://huggingface.co/datasets/dianavdavidson/MUCS-Hinglish)

| Metric | Base Whisper Large V3 | With LoRA | Change |
|---|---:|---:|---:|
| Word error rate | 60.00% | 45.57% | −14.43 percentage points |
| Character error rate | 48.41% | 33.46% | −14.95 percentage points |
| Word errors | 183 | 139 | −44 |

## GGML for whisper.cpp

The `ggml/ggml-large-v3-code-switch-q5_0-mixed.bin` file merges the LoRA weights into Whisper Large V3 and quantizes the full model to Q5_0 for whisper.cpp. It is 1.08 GB. Use it as the model file (`-m`) with whisper.cpp. Calibration used 16 clips selected by replaying the original training-source sampler and 16 IndicVoices clips. Activation importance weights were applied to 512 linear tensors. [IndicVoices](https://huggingface.co/datasets/ai4bharat/IndicVoices)

The same 21 MUCS Hinglish test clips were evaluated against the reference transcripts using CPU whisper.cpp, matched decoding, and Silero VAD. [MUCS Hinglish](https://huggingface.co/datasets/dianavdavidson/MUCS-Hinglish)

| GGML Q5_0 variant | WER | CER |
|---|---:|---:|
| Standard | 59.02% | 45.73% |
| IndicVoices calibration | 58.03% | 45.05% |
| Training-source and IndicVoices calibration | 58.36% | 44.98% |

A training-source transcript matched a test reference and was excluded from calibration. Excluding that clip from scoring preserved the WER ranking. The training run did not export its complete manifest, so other overlap with the original fine-tuning data remains possible.

SHA-256: `6806e7a9ee63aaa1930dd329812863335fe623295572d68888cbc5b9574e24c5`.

## Intended use and limitations

Use this adapter as an experimental checkpoint for Hindi–English ASR. The benchmark is a small sample of lecture speech, so performance may differ on spontaneous conversations, noisy calls, or other domains. The evaluation covers Hindi–English only. Bengali quality and deployment latency remain unmeasured. WER and CER are script-sensitive, including when a correct-sounding word is written in a different script.