Automatic Speech Recognition
Transformers
ONNX
Transformers.js
English
whisper
speech-recognition
encoder-decoder
webgpu
wasm
browser
rtx-5090
Instructions to use anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model") model = AutoModelForSpeechSeq2Seq.from_pretrained("anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model", device_map="auto") - Transformers.js
How to use anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('automatic-speech-recognition', 'anmol-unitmole/streaming-speech-recognition-whisper-encoder-decoder-model'); - Notebooks
- Google Colab
- Kaggle
Finalize Project 03 professional model card
Browse files
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 |
-
-
|
| 12 |
-
- encoder-decoder
|
| 13 |
-
- onnx
|
| 14 |
-
- transformers
|
| 15 |
-
- webgpu
|
| 16 |
-
- wasm
|
|
|
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
-
# Streaming Speech Recognition
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
| 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 |
-
##
|
| 30 |
|
| 31 |
-
The
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
| 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 |
-
##
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
-
|
| 62 |
|
| 63 |
-
Tiny
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
### Successful
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
| 70 |
-
- CER: 2.50% → 1.37%
|
| 71 |
|
| 72 |
-
|
| 73 |
|
| 74 |
-
## ONNX
|
| 75 |
|
| 76 |
-
The browser model was exported to ONNX and evaluated in both FP32 and Q8 configurations.
|
| 77 |
|
| 78 |
-
|
|
| 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
|
| 85 |
|
| 86 |
Therefore:
|
| 87 |
|
| 88 |
-
- **FP32 ONNX
|
| 89 |
-
- Q8
|
| 90 |
|
| 91 |
## Robustness Evaluation
|
| 92 |
|
| 93 |
-
The
|
| 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 |
-
|
| 109 |
-
|
| 110 |
-
## Browser Architecture
|
| 111 |
-
|
| 112 |
-
The deployed application performs inference client-side.
|
| 113 |
|
| 114 |
-
|
| 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 |
-
|
| 123 |
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
-
|
| 127 |
|
| 128 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
-
|
| 141 |
|
| 142 |
-
The evaluation
|
| 143 |
|
| 144 |
-
- WER
|
| 145 |
-
- CER
|
| 146 |
-
- latency
|
|
|
|
| 147 |
- Real-Time Factor
|
| 148 |
- GPU memory
|
| 149 |
-
-
|
| 150 |
-
-
|
| 151 |
- ONNX parity
|
| 152 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
| 154 |
## Limitations
|
| 155 |
|
| 156 |
-
- The
|
|
|
|
| 157 |
- Accent coverage in the current benchmark is limited.
|
| 158 |
-
- Performance degrades under severe
|
| 159 |
-
-
|
| 160 |
-
-
|
| 161 |
-
-
|
| 162 |
|
| 163 |
## Responsible Use
|
| 164 |
|
| 165 |
-
This
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
-
|
| 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 |
|