Xenova's picture
Xenova HF staff
Duplicate from Xenova/tiny-random-WhisperForConditionalGeneration
2a98138 verified
|
raw
history blame
831 Bytes
metadata
tags:
  - transformers.js

Code to generate:

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:

$ 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