Update model card for Whisper packs
Browse files
README.md
CHANGED
|
@@ -1,52 +1,137 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
## Structure
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
├──
|
| 12 |
-
│ ├──
|
| 13 |
-
│
|
| 14 |
-
|
| 15 |
-
├── hi/
|
| 16 |
-
├── ml/
|
| 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 |
## License
|
| 51 |
|
| 52 |
-
Apache 2.0
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- de
|
| 6 |
+
- fr
|
| 7 |
+
- es
|
| 8 |
+
- it
|
| 9 |
+
- pt
|
| 10 |
+
- nl
|
| 11 |
+
- pl
|
| 12 |
+
- ta
|
| 13 |
+
- hi
|
| 14 |
+
- te
|
| 15 |
+
- kn
|
| 16 |
+
- ml
|
| 17 |
+
tags:
|
| 18 |
+
- automatic-speech-recognition
|
| 19 |
+
- whisper
|
| 20 |
+
- sherpa-onnx
|
| 21 |
+
- onnx
|
| 22 |
+
- on-device
|
| 23 |
+
- quantized
|
| 24 |
+
library_name: sherpa-onnx
|
| 25 |
+
pipeline_tag: automatic-speech-recognition
|
| 26 |
+
base_model:
|
| 27 |
+
- openai/whisper-tiny
|
| 28 |
+
- vasista22/whisper-tamil-small
|
| 29 |
+
- vasista22/whisper-hindi-small
|
| 30 |
+
- vasista22/whisper-telugu-tiny
|
| 31 |
+
- vasista22/whisper-kannada-tiny
|
| 32 |
+
- kavyamanohar/whisper-small-malayalam
|
| 33 |
+
---
|
| 34 |
|
| 35 |
+
# indic-asr-onnx
|
| 36 |
+
|
| 37 |
+
INT8-quantized Whisper models in [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx)
|
| 38 |
+
format, packaged for on-device speech recognition.
|
| 39 |
+
|
| 40 |
+
## Packs
|
| 41 |
+
|
| 42 |
+
Each pack contains `encoder.int8.onnx`, `decoder.int8.onnx`, and `tokens.txt`,
|
| 43 |
+
and is downloaded independently at runtime.
|
| 44 |
+
|
| 45 |
+
| Pack | Languages | Size | Source model |
|
| 46 |
+
|---|---|---|---|
|
| 47 |
+
| `whisper-tiny` | en, de, fr, es, it, pt, nl, pl (+90 more) | 99 MB | [openai/whisper-tiny](https://huggingface.co/openai/whisper-tiny) |
|
| 48 |
+
| `whisper-small-ta` | Tamil | 358 MB | [vasista22/whisper-tamil-small](https://huggingface.co/vasista22/whisper-tamil-small) |
|
| 49 |
+
| `whisper-small-hi` | Hindi | 358 MB | [vasista22/whisper-hindi-small](https://huggingface.co/vasista22/whisper-hindi-small) |
|
| 50 |
+
| `whisper-small-ml` | Malayalam | 358 MB | [kavyamanohar/whisper-small-malayalam](https://huggingface.co/kavyamanohar/whisper-small-malayalam) |
|
| 51 |
+
| `whisper-tiny-te` | Telugu | 99 MB | [vasista22/whisper-telugu-tiny](https://huggingface.co/vasista22/whisper-telugu-tiny) |
|
| 52 |
+
| `whisper-tiny-kn` | Kannada | 99 MB | [vasista22/whisper-kannada-tiny](https://huggingface.co/vasista22/whisper-kannada-tiny) |
|
| 53 |
+
|
| 54 |
+
`whisper-tiny` is the multilingual base model — it serves all European languages
|
| 55 |
+
from a single download. The Indic packs are language-specific fine-tunes, which
|
| 56 |
+
substantially outperform stock Whisper on those languages.
|
| 57 |
|
| 58 |
## Structure
|
| 59 |
+
|
| 60 |
+
```
|
| 61 |
+
models/
|
| 62 |
+
├── whisper-tiny/
|
| 63 |
+
│ ├── encoder.int8.onnx
|
| 64 |
+
│ ├── decoder.int8.onnx
|
| 65 |
+
│ └── tokens.txt
|
| 66 |
+
├── whisper-small-ta/
|
| 67 |
+
├── whisper-small-hi/
|
| 68 |
+
├── whisper-small-ml/
|
| 69 |
+
├── whisper-tiny-te/
|
| 70 |
+
└── whisper-tiny-kn/
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Usage
|
| 74 |
+
|
| 75 |
+
### Python (sherpa-onnx)
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
import sherpa_onnx
|
| 79 |
+
|
| 80 |
+
recognizer = sherpa_onnx.OfflineRecognizer.from_whisper(
|
| 81 |
+
encoder="models/whisper-small-ta/encoder.int8.onnx",
|
| 82 |
+
decoder="models/whisper-small-ta/decoder.int8.onnx",
|
| 83 |
+
tokens="models/whisper-small-ta/tokens.txt",
|
| 84 |
+
language="ta",
|
| 85 |
+
task="transcribe",
|
| 86 |
+
num_threads=2,
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
stream = recognizer.create_stream()
|
| 90 |
+
stream.accept_waveform(16000, samples) # float32 PCM, 16 kHz mono
|
| 91 |
+
recognizer.decode_stream(stream)
|
| 92 |
+
print(stream.result.text)
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### Android (Kotlin)
|
| 96 |
+
|
| 97 |
+
```kotlin
|
| 98 |
+
val config = OfflineRecognizerConfig(
|
| 99 |
+
featConfig = FeatureConfig(sampleRate = 16000, featureDim = 80),
|
| 100 |
+
modelConfig = OfflineModelConfig(
|
| 101 |
+
whisper = OfflineWhisperModelConfig(
|
| 102 |
+
encoder = "$packDir/encoder.int8.onnx",
|
| 103 |
+
decoder = "$packDir/decoder.int8.onnx",
|
| 104 |
+
language = "ta",
|
| 105 |
+
task = "transcribe",
|
| 106 |
+
),
|
| 107 |
+
tokens = "$packDir/tokens.txt",
|
| 108 |
+
numThreads = 2,
|
| 109 |
+
)
|
| 110 |
+
)
|
| 111 |
+
val recognizer = OfflineRecognizer(config)
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
## Export
|
| 115 |
+
|
| 116 |
+
Exported with sherpa-onnx's
|
| 117 |
+
[`scripts/whisper/export-onnx.py`](https://github.com/k2-fsa/sherpa-onnx/blob/master/scripts/whisper/export-onnx.py),
|
| 118 |
+
then dynamically quantized to INT8.
|
| 119 |
+
|
| 120 |
+
HuggingFace fine-tunes were first converted to OpenAI Whisper checkpoint format
|
| 121 |
+
(`{"dims": ..., "model_state_dict": ...}`) so the export script could load them.
|
| 122 |
+
|
| 123 |
+
Note: on PyTorch ≥ 2.9 the export script requires `dynamo=False` to be passed to
|
| 124 |
+
`torch.onnx.export` — the dynamo-based exporter fails on Whisper's
|
| 125 |
+
data-dependent positional embedding indexing.
|
| 126 |
+
|
| 127 |
+
## Credits
|
| 128 |
+
|
| 129 |
+
- Fine-tuned Indic models by **[vasista22](https://huggingface.co/vasista22)**
|
| 130 |
+
(Speech Lab, IIT Madras — funded by Bhashini, MeitY, Govt. of India) and
|
| 131 |
+
**[kavyamanohar](https://huggingface.co/kavyamanohar)**
|
| 132 |
+
- Base models by **OpenAI** ([Whisper](https://github.com/openai/whisper))
|
| 133 |
+
- Export tooling by **[k2-fsa](https://github.com/k2-fsa)** (sherpa-onnx)
|
| 134 |
|
| 135 |
## License
|
| 136 |
|
| 137 |
+
Apache 2.0, inherited from the upstream models.
|