Upload folder using huggingface_hub
Browse files- README.md +15 -7
- config.json +4 -0
- preprocessor_config.json +0 -15
- whisper-base_beamsearch.int8.onnx +3 -0
- whisper-base_beamsearch.onnx +3 -0
README.md
CHANGED
|
@@ -23,17 +23,25 @@ print(model.recognize("test.wav"))
|
|
| 23 |
|
| 24 |
## Code for models export
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
-
Download model and export with Beam Search and Forced Decoder Input Ids:
|
| 29 |
```shell
|
| 30 |
-
python3 -m onnxruntime.transformers.models.whisper.convert_to_onnx -m openai/whisper-base --output whisper-onnx --
|
| 31 |
```
|
| 32 |
|
| 33 |
-
Save
|
| 34 |
```py
|
| 35 |
-
from transformers import
|
| 36 |
|
| 37 |
-
processor =
|
| 38 |
processor.save_pretrained("whisper-onnx")
|
| 39 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
## Code for models export
|
| 25 |
|
| 26 |
+
Read onnxruntime [instruction](https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/python/tools/transformers/models/whisper/README.md) for convert Whisper to ONNX.
|
| 27 |
|
| 28 |
+
Download model and export with *Beam Search* and *Forced Decoder Input Ids*:
|
| 29 |
```shell
|
| 30 |
+
python3 -m onnxruntime.transformers.models.whisper.convert_to_onnx -m openai/whisper-base --output ./whisper-onnx --use_forced_decoder_ids --optimize_onnx --precision fp32
|
| 31 |
```
|
| 32 |
|
| 33 |
+
Save tokenizer config
|
| 34 |
```py
|
| 35 |
+
from transformers import WhisperTokenizer
|
| 36 |
|
| 37 |
+
processor = WhisperTokenizer.from_pretrained("openai/whisper-base")
|
| 38 |
processor.save_pretrained("whisper-onnx")
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Create `config.json`
|
| 42 |
+
```json
|
| 43 |
+
{
|
| 44 |
+
"model_type": "whisper-ort",
|
| 45 |
+
"features_size": 80
|
| 46 |
+
}
|
| 47 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "whisper-ort",
|
| 3 |
+
"features_size": 80
|
| 4 |
+
}
|
preprocessor_config.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"chunk_length": 30,
|
| 3 |
-
"dither": 0.0,
|
| 4 |
-
"feature_extractor_type": "WhisperFeatureExtractor",
|
| 5 |
-
"feature_size": 80,
|
| 6 |
-
"hop_length": 160,
|
| 7 |
-
"n_fft": 400,
|
| 8 |
-
"n_samples": 480000,
|
| 9 |
-
"nb_max_frames": 3000,
|
| 10 |
-
"padding_side": "right",
|
| 11 |
-
"padding_value": 0.0,
|
| 12 |
-
"processor_class": "WhisperProcessor",
|
| 13 |
-
"return_attention_mask": false,
|
| 14 |
-
"sampling_rate": 16000
|
| 15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
whisper-base_beamsearch.int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:537719570b1b859d5d805283f509bce621d8ebbba8189609d8fb12064a68530c
|
| 3 |
+
size 107166530
|
whisper-base_beamsearch.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:732180688d163f91283769140db2a63a47da21ca1c1379a6c686b4bd62f2c412
|
| 3 |
+
size 398028367
|