Skip to content

Commit 4897144

Browse files
committed
fix ipex version check
1 parent 5b3b72d commit 4897144

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

optimum/intel/ipex/modeling_base.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,18 @@
6262

6363

6464
def _is_patched_with_ipex(model, task):
65-
ipex_version = "2.2.0" if "xpu" in str(model.device) else "2.5.0"
66-
if is_ipex_version("<", ipex_version):
67-
return False
6865
if isinstance(model, torch.jit.ScriptModule):
66+
if is_ipex_version("<", "2.5.0"):
67+
return False
6968
for node in model.graph.nodes():
7069
# Jit will record the codes position so we can check if the node use ipex exporter.
7170
if "torch_ipex::rotary_position_embedding" in node.__str__():
7271
return True
7372
return False
7473
else:
74+
ipex_version = "2.2.0" if "xpu" in str(model.device) else "2.5.0"
75+
if is_ipex_version("<", ipex_version):
76+
return False
7577
return model.config.model_type in _IPEX_SUPPORT_MODEL_TYPES and task in _IPEX_EXPORTED_TASK
7678

7779

0 commit comments

Comments
 (0)