Skip to content

Commit 6b4d80b

Browse files
authored
Do not ignore runtime error in llm.optimize for well supported model (#3404)
1 parent 6cd8b2d commit 6b4d80b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

intel_extension_for_pytorch/transformers/optimize.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,11 +2039,15 @@ def optimize(
20392039
return _model
20402040

20412041
except RuntimeError as e:
2042-
logger.warning(
2043-
f"fail to apply ipex.llm.optimize due to: {e}, fallback to the origin model",
2044-
_type=WarningType.NotSupported,
2045-
)
2046-
return model
2042+
# if the model is not in the list, fallback without throwing errors
2043+
if not well_supported_model:
2044+
logger.warning(
2045+
f"fail to apply ipex.llm.optimize due to: {e}, fallback to the origin model",
2046+
_type=WarningType.NotSupported,
2047+
)
2048+
return model
2049+
else:
2050+
raise e
20472051

20482052
return model
20492053

0 commit comments

Comments
 (0)