Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
{}
|
| 3 |
+
---
|
| 4 |
+
Code to generate:
|
| 5 |
+
|
| 6 |
+
```py
|
| 7 |
+
from transformers import WhisperForConditionalGeneration, AutoProcessor
|
| 8 |
+
|
| 9 |
+
new_config_values = dict(
|
| 10 |
+
d_model = 16,
|
| 11 |
+
decoder_attention_heads = 4,
|
| 12 |
+
decoder_layers = 1,
|
| 13 |
+
encoder_attention_heads = 4,
|
| 14 |
+
encoder_layers = 1,
|
| 15 |
+
num_hidden_layers = 1,
|
| 16 |
+
|
| 17 |
+
ignore_mismatched_sizes=True,
|
| 18 |
+
)
|
| 19 |
+
original_model = WhisperForConditionalGeneration.from_pretrained('openai/whisper-tiny', **new_config_values)
|
| 20 |
+
original_model.save_pretrained('converted')
|
| 21 |
+
|
| 22 |
+
original_processor = AutoProcessor.from_pretrained('openai/whisper-tiny')
|
| 23 |
+
original_processor.save_pretrained('converted')
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
Followed by:
|
| 27 |
+
```sh
|
| 28 |
+
$ mkdir -p ./converted/onnx
|
| 29 |
+
$ optimum-cli export onnx -m ./converted ./converted/onnx --task automatic-speech-recognition-with-past
|
| 30 |
+
$ find ./converted/onnx -type f ! -name "*.onnx" -delete
|
| 31 |
+
```
|