Skip to content

Commit 0a4951a

Browse files
committed
move all conditions to allow_skip_check_trace
1 parent 66e8e6a commit 0a4951a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

optimum/exporters/openvino/convert.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
_transformers_version,
4848
compare_versions,
4949
is_openvino_tokenizers_version,
50-
is_openvino_version,
5150
is_tokenizers_version,
5251
is_transformers_version,
5352
)
@@ -437,9 +436,7 @@ def ts_patched_forward(*args, **kwargs):
437436
patcher.patched_forward = ts_patched_forward
438437

439438
ts_decoder_kwargs = {}
440-
if (library_name == "diffusers" or allow_skip_tracing_check(model)) and is_openvino_version(
441-
">=", "2025.0"
442-
):
439+
if allow_skip_tracing_check(library_name, model):
443440
ts_decoder_kwargs["trace_kwargs"] = {"check_trace": False}
444441

445442
with patcher:

optimum/exporters/openvino/utils.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from optimum.exporters import TasksManager
2727
from optimum.exporters.onnx.base import OnnxConfig
2828
from optimum.intel.utils import is_transformers_version
29-
from optimum.intel.utils.import_utils import is_safetensors_available
29+
from optimum.intel.utils.import_utils import is_openvino_version, is_safetensors_available
3030
from optimum.utils import is_diffusers_available
3131
from optimum.utils.save_utils import maybe_save_preprocessors
3232

@@ -317,7 +317,11 @@ def save_preprocessors(
317317
SKIP_CHECK_TRACE_MODELS = ("deepseek", "deepseek-v2", "deepseek-v3")
318318

319319

320-
def allow_skip_tracing_check(model):
320+
def allow_skip_tracing_check(library_name, model):
321+
if is_openvino_version("<", "2025.0.0"):
322+
return False
323+
if library_name == "diffusers":
324+
return True
321325
config = getattr(model, "config", {})
322326
model_type = getattr(config, "model_type", "").replace("_", "-")
323327
return model_type in SKIP_CHECK_TRACE_MODELS

0 commit comments

Comments
 (0)