Skip to content

Commit

Permalink
disable transformers 4.45 for onnx export
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Sep 30, 2024
1 parent 0e2ed87 commit bc28f03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions optimum/exporters/onnx/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import numpy as np
import onnx
import transformers
from transformers.modeling_utils import get_parameter_dtype
from transformers.utils import is_tf_available, is_torch_available

Expand Down Expand Up @@ -1000,6 +1001,10 @@ def onnx_export_from_model(
>>> onnx_export_from_model(model, output="gpt2_onnx/")
```
"""
if check_if_transformers_greater("4.44.99"):
raise ImportError(
f"ONNX conversion disabled for now for transformers version greater than v4.45, found {transformers.__version__}"
)

TasksManager.standardize_model_attributes(model)

Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"datasets>=1.2.1",
"evaluate",
"protobuf>=3.20.1",
"transformers<4.45.0",
],
"onnxruntime-gpu": [
"onnx",
Expand All @@ -62,9 +63,10 @@
"evaluate",
"protobuf>=3.20.1",
"accelerate", # ORTTrainer requires it.
"transformers<4.45.0",
],
"exporters": ["onnx", "onnxruntime", "timm"],
"exporters-gpu": ["onnx", "onnxruntime-gpu", "timm"],
"exporters": ["onnx", "onnxruntime", "timm", "transformers<4.45.0"],
"exporters-gpu": ["onnx", "onnxruntime-gpu", "timm", "transformers<4.45.0"],
"exporters-tf": [
"tensorflow>=2.4,<=2.12.1",
"tf2onnx",
Expand All @@ -75,6 +77,7 @@
"numpy<1.24.0",
"datasets<=2.16",
"transformers[sentencepiece]>=4.26,<4.38",
"transformers<4.45.0",
],
"diffusers": ["diffusers"],
"intel": "optimum-intel>=1.18.0",
Expand Down

0 comments on commit bc28f03

Please sign in to comment.