anmol-unitmole commited on
Commit
ad0c4ba
·
verified ·
1 Parent(s): 765659b

Finalize Project 03 professional model card

Browse files
Files changed (1) hide show
  1. README.md +170 -94
README.md CHANGED
@@ -1,100 +1,107 @@
1
  ---
2
  language:
3
- - en
4
  license: mit
5
  library_name: transformers
6
  pipeline_tag: automatic-speech-recognition
7
  base_model: openai/whisper-tiny.en
8
  tags:
9
- - whisper
10
- - speech-recognition
11
- - automatic-speech-recognition
12
- - encoder-decoder
13
- - onnx
14
- - transformers-js
15
- - webgpu
16
- - wasm
 
 
17
  ---
18
 
19
- # Streaming Speech Recognition — Whisper Encoder-Decoder
20
 
21
- Production-oriented automatic speech recognition project built around the Whisper encoder-decoder architecture, with LoRA/PEFT experimentation, robustness evaluation, ONNX optimization, and browser-side deployment.
 
 
22
 
23
  ## Live Resources
24
 
25
  - **Live Demo:** https://huggingface.co/spaces/anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder
26
- - **GitHub:** https://github.com/unit-mole/encoder-decoder-projects/tree/main/03-streaming-speech-recognition-whisper-encoder-decoder
27
  - **Model Repository:** https://huggingface.co/anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model
28
 
29
- ## Browser Model
30
 
31
- The deployment model is based on:
32
 
33
- `openai/whisper-tiny.en`
34
 
35
- The pretrained Tiny model was selected for browser deployment from measured evaluation evidence rather than assuming that fine-tuning would automatically improve every model.
36
 
37
- ### Browser Champion
 
 
 
 
 
 
 
38
 
39
- | Metric | Result |
40
- |---|---:|
41
- | Test examples | 1,452 |
42
- | WER | 6.09% |
43
- | CER | 2.64% |
44
- | Average latency | 0.118 s |
45
- | Real-Time Factor | 0.017 |
46
- | Peak GPU memory | ~151 MB |
47
 
48
- ## Model Experiments
49
 
50
- Tiny, Small, and Medium Whisper models were evaluated in both pretrained and LoRA fine-tuned configurations.
51
 
52
- | Model | WER | CER |
53
- |---|---:|---:|
54
- | Whisper Tiny pretrained | 6.09% | 2.64% |
55
- | Whisper Tiny LoRA | 16.76% | 6.64% |
56
- | Whisper Small pretrained | **3.46%** | 1.44% |
57
- | Whisper Small LoRA | 6.26% | 2.17% |
58
- | Whisper Medium pretrained | 4.68% | 2.50% |
59
- | Whisper Medium LoRA | 4.23% | **1.37%** |
 
 
 
60
 
61
- The experiments demonstrate that fine-tuning is not automatically beneficial.
62
 
63
- Tiny and Small LoRA configurations regressed relative to their pretrained baselines, while Medium LoRA produced a measurable improvement.
 
 
64
 
65
- ### Successful Fine-Tuning Result
66
 
67
- Whisper Medium improved from:
 
 
 
68
 
69
- - WER: 4.68% → 4.23%
70
- - CER: 2.50% → 1.37%
71
 
72
- This Medium LoRA experiment is retained as the strongest fine-tuning result, while Tiny pretrained is used for browser deployment because of its substantially lower latency and memory requirements.
73
 
74
- ## ONNX Browser Optimization
75
 
76
- The browser model was exported to ONNX and evaluated in both FP32 and Q8 configurations.
77
 
78
- | Variant | WER | Relative WER Change | Prediction Match |
79
  |---|---:|---:|---:|
80
  | PyTorch | 6.12% | Baseline | — |
81
- | FP32 ONNX | **5.90%** | **-3.57%** | **98%** |
82
  | Q8 ONNX | 6.45% | +5.36% | 94% |
83
 
84
- The release quality gate permitted a maximum 2% relative WER regression.
85
 
86
  Therefore:
87
 
88
- - **FP32 ONNX passed the quality gate and is the production browser configuration.**
89
- - Q8 did not pass the quality gate and is retained only as an experimental optimization artifact.
90
 
91
  ## Robustness Evaluation
92
 
93
- The browser champion was evaluated on 1,800 robustness examples generated from 300 source recordings.
94
-
95
- Overall robustness WER: **9.45%**
96
-
97
- Selected conditions:
98
 
99
  | Condition | WER |
100
  |---|---:|
@@ -105,66 +112,135 @@ Selected conditions:
105
  | Medium Gaussian noise | 11.15% |
106
  | Heavy Gaussian noise | 21.14% |
107
 
108
- The results show increasing degradation under severe additive noise, which is documented as a known limitation.
109
-
110
- ## Browser Architecture
111
-
112
- The deployed application performs inference client-side.
113
 
114
- Audio Input
115
- → Browser preprocessing
116
- → Whisper feature extraction
117
- → FP32 ONNX encoder-decoder inference
118
- → Chunk aggregation
119
- → Transcript + timestamps
120
- → Evaluation / confidence presentation
121
 
122
- The static application is designed for deployment without a Python inference server.
123
 
124
- ## Deployment
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
- The application supports:
127
 
128
- - audio upload
129
- - microphone recording
130
- - sample audio
131
- - chunked transcription
132
- - progress reporting
133
- - timestamps
134
- - evaluation dashboard
135
- - WebGPU-capable browsers
136
- - WASM fallback
137
 
138
- ## Training and Evaluation
 
 
 
 
 
 
 
139
 
140
- Training and model experiments were executed locally using an NVIDIA RTX 5090 with mixed-precision BF16 training.
141
 
142
- The evaluation pipeline includes:
143
 
144
- - WER
145
- - CER
146
- - latency
 
147
  - Real-Time Factor
148
  - GPU memory
149
- - robustness slices
150
- - noise degradation
151
  - ONNX parity
152
- - browser deployment selection
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
  ## Limitations
155
 
156
- - The primary benchmark is based on English LibriSpeech-style speech.
 
157
  - Accent coverage in the current benchmark is limited.
158
- - Performance degrades under severe Gaussian noise.
159
- - The deployed browser model is English-only.
160
- - Browser performance depends on device hardware and browser runtime.
161
- - Q8 quantization was rejected for the default release because it exceeded the defined quality-regression threshold.
162
 
163
  ## Responsible Use
164
 
165
- This system is intended for experimentation, education, portfolio demonstration, and general speech transcription.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
- Transcriptions should not be treated as infallible in medical, legal, emergency, security-sensitive, or other high-stakes applications.
168
 
169
  ## License
170
 
 
1
  ---
2
  language:
3
+ - en
4
  license: mit
5
  library_name: transformers
6
  pipeline_tag: automatic-speech-recognition
7
  base_model: openai/whisper-tiny.en
8
  tags:
9
+ - whisper
10
+ - automatic-speech-recognition
11
+ - speech-recognition
12
+ - encoder-decoder
13
+ - onnx
14
+ - transformers.js
15
+ - webgpu
16
+ - wasm
17
+ - browser
18
+ - rtx-5090
19
  ---
20
 
21
+ # Streaming Speech Recognition with Whisper Encoder-Decoder
22
 
23
+ Browser-deployable automatic speech recognition system built around the Whisper encoder-decoder architecture, with LoRA/PEFT experimentation, robustness benchmarking, ONNX optimization, and static client-side deployment.
24
+
25
+ > **Production artifact in this repository:** Whisper Tiny English FP32 ONNX browser model selected from measured evaluation evidence.
26
 
27
  ## Live Resources
28
 
29
  - **Live Demo:** https://huggingface.co/spaces/anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder
30
+ - **GitHub Project:** https://github.com/unit-mole/encoder-decoder-projects/tree/main/03-streaming-speech-recognition-whisper-encoder-decoder
31
  - **Model Repository:** https://huggingface.co/anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model
32
 
33
+ ## Model Selection
34
 
35
+ The project evaluated Whisper Tiny, Small, and Medium in both pretrained and LoRA fine-tuned configurations.
36
 
37
+ The final browser model was selected based on **accuracy, latency, memory footprint, real-time factor, and ONNX parity**, rather than assuming that fine-tuning would always improve performance.
38
 
39
+ ### Test-Set Results
40
 
41
+ | Model | WER | CER | Avg. Latency |
42
+ |---|---:|---:|---:|
43
+ | Tiny pretrained | **6.09%** | 2.64% | **0.118 s** |
44
+ | Tiny LoRA | 16.76% | 6.64% | 0.262 s |
45
+ | Small pretrained | **3.46%** | 1.44% | 0.232 s |
46
+ | Small LoRA | 6.26% | 2.17% | 0.619 s |
47
+ | Medium pretrained | 4.68% | 2.50% | 0.405 s |
48
+ | Medium LoRA | 4.23% | **1.37%** | 1.188 s |
49
 
50
+ All values above come from the project's held-out **1,452-example test evaluation**.
 
 
 
 
 
 
 
51
 
52
+ ## Why Whisper Tiny for Browser Deployment?
53
 
54
+ Whisper Small pretrained achieved the lowest overall WER, but Whisper Tiny pretrained was selected as the **browser champion** because it provided a substantially lighter runtime:
55
 
56
+ - WER: **6.09%**
57
+ - CER: **2.64%**
58
+ - Average latency: **0.118 s**
59
+ - Real-Time Factor: **0.017**
60
+ - Peak measured GPU memory: **~151 MB**
61
+
62
+ This provides a stronger quality/performance trade-off for browser deployment.
63
+
64
+ ## Fine-Tuning Findings
65
+
66
+ LoRA/PEFT fine-tuning was performed for Tiny, Small, and Medium Whisper models.
67
 
68
+ Fine-tuning did **not** improve every model:
69
 
70
+ - Tiny LoRA regressed relative to Tiny pretrained.
71
+ - Small LoRA regressed relative to Small pretrained.
72
+ - Medium LoRA produced a measurable improvement.
73
 
74
+ ### Successful Medium LoRA Result
75
 
76
+ | Metric | Medium pretrained | Medium LoRA |
77
+ |---|---:|---:|
78
+ | WER | 4.68% | **4.23%** |
79
+ | CER | 2.50% | **1.37%** |
80
 
81
+ The Medium LoRA experiment is retained as the strongest fine-tuning result.
 
82
 
83
+ **Important:** the Medium LoRA checkpoint is experimental evidence from the broader project. This Hugging Face repository contains the selected Tiny browser deployment artifact.
84
 
85
+ ## ONNX Optimization
86
 
87
+ The selected Tiny browser model was exported to ONNX and evaluated in both FP32 and Q8 configurations.
88
 
89
+ | Runtime | WER | Relative WER Change | Prediction Match |
90
  |---|---:|---:|---:|
91
  | PyTorch | 6.12% | Baseline | — |
92
+ | **FP32 ONNX** | **5.90%** | **-3.57%** | **98%** |
93
  | Q8 ONNX | 6.45% | +5.36% | 94% |
94
 
95
+ The project release criterion allowed no more than **2% relative WER regression**.
96
 
97
  Therefore:
98
 
99
+ - ✅ **FP32 ONNX is the production/default browser artifact**
100
+ - ⚠️ Q8 is retained only as an experimental optimization artifact
101
 
102
  ## Robustness Evaluation
103
 
104
+ The selected Tiny pretrained model was evaluated on **1,800 robustness examples** derived from 300 source recordings.
 
 
 
 
105
 
106
  | Condition | WER |
107
  |---|---:|
 
112
  | Medium Gaussian noise | 11.15% |
113
  | Heavy Gaussian noise | 21.14% |
114
 
115
+ Overall robustness WER: **9.45%**
 
 
 
 
116
 
117
+ The largest degradation occurs under heavy additive Gaussian noise.
 
 
 
 
 
 
118
 
119
+ ## Browser Architecture
120
 
121
+ ```text
122
+ Microphone / Audio Upload
123
+ ↓
124
+ Browser Audio Preprocessing
125
+ ↓
126
+ Whisper Feature Extraction
127
+ ↓
128
+ FP32 ONNX Encoder
129
+ ↓
130
+ Autoregressive Decoder
131
+ ↓
132
+ Chunk Aggregation
133
+ ↓
134
+ Transcript + Timestamps
135
+ ```
136
+
137
+ The application performs inference client-side without requiring a Python inference server.
138
+
139
+ ## Browser Features
140
+
141
+ The deployed application includes:
142
+
143
+ - Microphone recording
144
+ - Audio file upload
145
+ - Bundled sample audio
146
+ - Audio preview
147
+ - Chunked transcription
148
+ - Transcription progress
149
+ - Final transcript
150
+ - Timestamps
151
+ - Confidence/result presentation
152
+ - Evaluation dashboard
153
+ - WebGPU-capable execution
154
+ - WASM fallback
155
 
156
+ ## Experimental Environment
157
 
158
+ Training and evaluation were executed locally using:
 
 
 
 
 
 
 
 
159
 
160
+ - **GPU:** NVIDIA RTX 5090
161
+ - **VRAM:** 32 GB
162
+ - **CUDA:** 13.0
163
+ - **Python:** 3.12
164
+ - **PyTorch:** 2.13
165
+ - **Transformers:** 4.57.6
166
+ - **PEFT:** 0.20.0
167
+ - **Mixed Precision:** BF16
168
 
169
+ ## Evaluation Pipeline
170
 
171
+ The evaluation workflow measures:
172
 
173
+ - Word Error Rate (WER)
174
+ - Character Error Rate (CER)
175
+ - Average latency
176
+ - P95 latency
177
  - Real-Time Factor
178
  - GPU memory
179
+ - Robustness slices
180
+ - Noise degradation
181
  - ONNX parity
182
+ - Quantization regression
183
+ - Browser deployment suitability
184
+
185
+ ## Intended Use
186
+
187
+ This model and project are suitable for:
188
+
189
+ - Speech recognition experimentation
190
+ - Browser-side ASR demonstrations
191
+ - Whisper encoder-decoder research
192
+ - ONNX inference experimentation
193
+ - WebGPU/WASM deployment experiments
194
+ - Machine learning portfolio demonstrations
195
+ - Educational use
196
 
197
  ## Limitations
198
 
199
+ - The deployment model is English-only.
200
+ - The main benchmark is based on LibriSpeech-style English speech.
201
  - Accent coverage in the current benchmark is limited.
202
+ - Performance degrades under severe additive environmental noise.
203
+ - Browser latency depends on hardware and browser runtime.
204
+ - Q8 quantization exceeded the project's quality-regression threshold.
205
+ - Speech recognition output may contain transcription errors.
206
 
207
  ## Responsible Use
208
 
209
+ This project is intended for experimentation, education, research, portfolio demonstration, and general transcription.
210
+
211
+ Speech recognition output should **not** be treated as infallible.
212
+
213
+ Human review should be used before relying on transcripts in:
214
+
215
+ - Medical applications
216
+ - Legal applications
217
+ - Emergency situations
218
+ - Safety-critical systems
219
+ - Security-sensitive workflows
220
+ - Other high-stakes environments
221
+
222
+ ## Reproducibility
223
+
224
+ The complete source code includes:
225
+
226
+ - Dataset preparation
227
+ - Dataset auditing
228
+ - LoRA hyperparameter sweeps
229
+ - Tiny/Small/Medium Whisper training
230
+ - Pretrained vs fine-tuned evaluation
231
+ - Robustness benchmarking
232
+ - Failure analysis
233
+ - ONNX export
234
+ - Q8 quantization
235
+ - ONNX parity validation
236
+ - Browser model selection
237
+ - Static web deployment
238
+ - Automated Python tests
239
+ - JavaScript/browser testing
240
+
241
+ The full implementation is available here:
242
 
243
+ https://github.com/unit-mole/encoder-decoder-projects/tree/main/03-streaming-speech-recognition-whisper-encoder-decoder
244
 
245
  ## License
246