Skip to content

Commit

Permalink
Remove dead code in whisper ONNX output (#741)
Browse files Browse the repository at this point in the history
fix whisper output
  • Loading branch information
fxmarty authored Feb 3, 2023
1 parent 334d3cf commit e8f5a95
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions optimum/exporters/onnx/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,11 +916,9 @@ def inputs(self) -> Mapping[str, Mapping[int, str]]:
def outputs(self) -> Mapping[str, Mapping[int, str]]:
common_outputs = super().outputs
if self._behavior is ConfigBehavior.ENCODER:
for name, dyanmic_axes in common_outputs.items():
if name == "last_hidden_state":
common_outputs[name][1] = f"{common_outputs[name][1]} / 2"
else:
common_outputs[name] = dynamic_axes
# for whisper, we need to name the second axis as
# encoder_sequence_length / 2 as the axis name is used for dummy input generation
common_outputs["last_hidden_state"][1] = f"{common_outputs['last_hidden_state'][1]} / 2"
return common_outputs


Expand Down

0 comments on commit e8f5a95

Please sign in to comment.