Skip to content

Commit

Permalink
Fix whisper v3 ONNX export (#1525)
Browse files Browse the repository at this point in the history
fix whisper onnx export
  • Loading branch information
fxmarty authored Nov 9, 2023
1 parent 9ca2473 commit 832f3b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions optimum/exporters/onnx/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,8 @@ class WhisperOnnxConfig(AudioToTextOnnxConfig):
NORMALIZED_CONFIG_CLASS = NormalizedSeq2SeqConfig.with_args(
encoder_num_layers="encoder_layers",
decoder_num_layers="decoder_layers",
feature_size="num_mel_bins",
allow_new=True,
)
ATOL_FOR_VALIDATION = 1e-3

Expand Down
5 changes: 4 additions & 1 deletion optimum/utils/input_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,10 @@ def __init__(
self.task = task
self.normalized_config = normalized_config

self.feature_size = feature_size
if hasattr(self.normalized_config, "feature_size"):
self.feature_size = self.normalized_config.feature_size
else:
self.feature_size = feature_size
self.nb_max_frames = nb_max_frames
self.batch_size = batch_size
self.sequence_length = audio_sequence_length
Expand Down

0 comments on commit 832f3b2

Please sign in to comment.