File size: 831 Bytes
2a98138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
tags:
- transformers.js
---

Code to generate:

```py
from transformers import WhisperForConditionalGeneration, AutoProcessor

new_config_values = dict(
  d_model = 16,
  decoder_attention_heads = 4,
  decoder_layers = 1,
  encoder_attention_heads = 4,
  encoder_layers = 1,
  num_hidden_layers = 1,

  ignore_mismatched_sizes=True,
)
original_model = WhisperForConditionalGeneration.from_pretrained('openai/whisper-tiny', **new_config_values)
original_model.save_pretrained('converted')

original_processor = AutoProcessor.from_pretrained('openai/whisper-tiny')
original_processor.save_pretrained('converted')
```

Followed by:
```sh
$ mkdir -p ./converted/onnx
$ optimum-cli export onnx -m ./converted ./converted/onnx --task automatic-speech-recognition-with-past
$ find ./converted/onnx -type f ! -name "*.onnx" -delete
```