GL3MON commited on
Commit
51ceae2
·
verified ·
1 Parent(s): f2111d0

Publish Whisper Large V3 code-switch LoRA and evaluation card

Browse files
Files changed (3) hide show
  1. README.md +106 -0
  2. adapter_config.json +37 -0
  3. adapter_model.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: openai/whisper-large-v3
3
+ base_model_relation: adapter
4
+ library_name: peft
5
+ pipeline_tag: automatic-speech-recognition
6
+ language:
7
+ - hi
8
+ - en
9
+ - bn
10
+ datasets:
11
+ - dianavdavidson/MUCS-Hinglish
12
+ - tiny-aya-translate/hinglish-casual
13
+ - addyo07/noisy-hinglish-asr
14
+ - niloycste68/Bangali_local_dialect_ASR_HF_Dataset
15
+ tags:
16
+ - whisper
17
+ - lora
18
+ - code-switching
19
+ - hinglish
20
+ - safetensors
21
+ metrics:
22
+ - wer
23
+ - cer
24
+ model-index:
25
+ - name: Whisper Large V3 Code-Switch LoRA
26
+ results:
27
+ - task:
28
+ type: automatic-speech-recognition
29
+ dataset:
30
+ name: MUCS Hinglish test subset (21 clips)
31
+ type: dianavdavidson/MUCS-Hinglish
32
+ split: test
33
+ metrics:
34
+ - name: Word error rate (%)
35
+ type: wer
36
+ value: 45.57
37
+ - name: Character error rate (%)
38
+ type: cer
39
+ value: 33.46
40
+ ---
41
+
42
+ # Whisper Large V3 Code-Switch LoRA
43
+
44
+ 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 adapter has about 7.86 million trainable parameters and adds about 30 MiB on disk.
45
+
46
+ 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. [Training run](https://www.kaggle.com/code/gl3monharisshh/whisper-large-v3-code-switch-asr/output)
47
+
48
+ ## Usage
49
+
50
+ 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.
51
+
52
+ ```python
53
+ import soundfile as sf
54
+ import torch
55
+ from peft import PeftModel
56
+ from transformers import WhisperForConditionalGeneration, WhisperProcessor
57
+
58
+ base_id = "openai/whisper-large-v3"
59
+ adapter_id = "GL3MON/whisper-large-v3-code-switch-lora"
60
+
61
+ processor = WhisperProcessor.from_pretrained(base_id)
62
+ base = WhisperForConditionalGeneration.from_pretrained(base_id, torch_dtype=torch.float32)
63
+ model = PeftModel.from_pretrained(base, adapter_id).eval()
64
+
65
+ audio, rate = sf.read("utterance.wav", dtype="float32")
66
+ if rate != 16_000 or audio.ndim != 1 or not 0 < len(audio) <= 30 * rate:
67
+ raise ValueError("Use a mono 16 kHz WAV of up to 30 seconds")
68
+
69
+ features = processor.feature_extractor(
70
+ audio, sampling_rate=rate, return_tensors="pt", return_attention_mask=True
71
+ )
72
+ with torch.inference_mode():
73
+ tokens = model.generate(
74
+ **features, language="hi", task="transcribe",
75
+ num_beams=1, do_sample=False, max_new_tokens=128,
76
+ )
77
+ print(processor.batch_decode(tokens, skip_special_tokens=True)[0])
78
+ ```
79
+
80
+ ## Training data
81
+
82
+ | Source | Training clips | Held back during training |
83
+ |---|---:|---:|
84
+ | MUCS Hinglish | 512 | 24 |
85
+ | Hinglish Casual | 512 | 0 |
86
+ | Noisy Hinglish ASR | 419 | 24 |
87
+ | Bangali Local Dialect ASR | 140 | 24 |
88
+ | Total | 1,583 | 72 |
89
+
90
+ 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)
91
+
92
+ ## Independent evaluation
93
+
94
+ 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)
95
+
96
+ | Metric | Base Whisper Large V3 | With LoRA | Change |
97
+ |---|---:|---:|---:|
98
+ | Word error rate | 60.00% | 45.57% | −14.43 percentage points |
99
+ | Character error rate | 48.41% | 33.46% | −14.95 percentage points |
100
+ | Word errors | 183 | 139 | −44 |
101
+
102
+ Dataset row indices, zero-based: 0, 150, 301, 450, 600, 750, 900, 1050, 1200, 1351, 1501, 1650, 1800, 1950, 2100, 2255, 2401, 2550, 2700, 2850, 3005.
103
+
104
+ ## Intended use and limitations
105
+
106
+ 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.
adapter_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": {
4
+ "base_model_class": "WhisperForConditionalGeneration",
5
+ "parent_library": "transformers.models.whisper.modeling_whisper"
6
+ },
7
+ "base_model_name_or_path": "openai/whisper-large-v3",
8
+ "bias": "none",
9
+ "corda_config": null,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 32,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "megatron_config": null,
23
+ "megatron_core": "megatron.core",
24
+ "modules_to_save": null,
25
+ "peft_type": "LORA",
26
+ "r": 16,
27
+ "rank_pattern": {},
28
+ "revision": null,
29
+ "target_modules": [
30
+ "q_proj",
31
+ "v_proj"
32
+ ],
33
+ "task_type": null,
34
+ "trainable_token_indices": null,
35
+ "use_dora": false,
36
+ "use_rslora": false
37
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fd0cdfe3039c96e0819de9cda08808692586932bd46109282da5762546a9fa2
3
+ size 31512224