Skip to content

Commit

Permalink
add warning
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Oct 29, 2024
1 parent 641d351 commit d1725f7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions optimum/exporters/onnx/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,15 @@ class Phi3OnnxConfig(PhiOnnxConfig):
NORMALIZED_CONFIG_CLASS = NormalizedTextConfigWithGQA
MIN_TRANSFORMERS_VERSION = version.parse("4.41.0")

def __init__(self, *args, **kwargs):
# TODO : replace check_if_transformers_greater with is_transformers_available
if check_if_transformers_greater("4.46.0") and not check_if_transformers_greater("4.46.1"):
logger.error(
"Found transformers v4.46.0 while trying to exporting a Phi3 model, this specific version of transformers is not supported. "
"Please upgrade to v4.46.1 or higher, or downgrade your transformers version"
)
super().__init__(*args, **kwargs)


class MistralOnnxConfig(TextDecoderWithPositionIdsOnnxConfig):
# This is because of the patching of torch.triu in AttentionMaskConverter, that exists from transformers>=4.35
Expand Down Expand Up @@ -2168,6 +2177,19 @@ class Pix2StructOnnxConfig(OnnxSeq2SeqConfigWithPast):

DEFAULT_ONNX_OPSET = 14 # use 'aten::triu' now which is opset 14

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# TODO : replace check_if_transformers_greater with is_transformers_available
if (
check_if_transformers_greater("4.46.0")
and not check_if_transformers_greater("4.46.1")
and self._behavior is ConfigBehavior.DECODER
):
logger.error(
"Found transformers v4.46.0 while trying to exporting a Pix2Struct model, this specific version of transformers is not supported. "
"Please upgrade to v4.46.1 or higher, or downgrade your transformers version"
)

@property
def inputs(self):
common_inputs = {}
Expand Down

0 comments on commit d1725f7

Please sign in to comment.