Skip to content

Commit

Permalink
T5Encoder inherits from TextEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Nov 18, 2024
1 parent 8b12d7a commit b1b295d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions optimum/exporters/onnx/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,11 @@ def outputs(self) -> Dict[str, Dict[int, str]]:
}


class T5EncoderOnnxConfig(CLIPTextOnnxConfig):
class T5EncoderOnnxConfig(TextEncoderOnnxConfig):
NORMALIZED_CONFIG_CLASS = NormalizedTextConfig
ATOL_FOR_VALIDATION = 1e-4
DEFAULT_ONNX_OPSET = 12 # int64 was supported since opset 12

@property
def inputs(self):
return {
Expand Down Expand Up @@ -2120,9 +2124,9 @@ def outputs(self) -> Dict[str, Dict[int, str]]:
# for Speech2text, we need to name the second axis as
# encoder_sequence_length / 2 * self._config.num_conv_layers as the axis name is
# used for dummy input generation
common_outputs["last_hidden_state"][
1
] = f"{common_outputs['last_hidden_state'][1]} / {(2 * self._config.num_conv_layers)}"
common_outputs["last_hidden_state"][1] = (
f"{common_outputs['last_hidden_state'][1]} / {(2 * self._config.num_conv_layers)}"
)
return common_outputs


Expand Down

0 comments on commit b1b295d

Please sign in to comment.