Skip to content

Commit 9fa361e

Browse files
committed
Fix style, show OpenVINO version
1 parent a85b8aa commit 9fa361e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

optimum/exporters/openvino/model_patcher.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import logging as log
1616

1717
from optimum.intel.utils.import_utils import (
18+
_openvino_version,
1819
_torch_version,
1920
_transformers_version,
2021
is_openvino_version,
@@ -41,10 +42,17 @@ def patch_model_with_bettertransformer(model):
4142
+ COLOR_RESET
4243
)
4344

44-
if getattr(model.config, "model_type") in {"gpt_bigcode", "llama"} and is_transformers_version(">=", "4.38") and is_openvino_version("<", "2024.1.0-14612"):
45+
if (
46+
getattr(model.config, "model_type") in {"gpt_bigcode", "llama"}
47+
and is_transformers_version(">=", "4.38")
48+
and is_openvino_version("<", "2024.1.0-14612")
49+
):
50+
display_version = (
51+
_openvino_version.split("-")[0] if _openvino_version.startswith("2024.0") else _openvino_version
52+
)
4553
log.warn(
4654
COLOR_RED + f"[WARNING] Stateful models are not supported with Transformers {_transformers_version} and "
47-
"this OpenVINO version. For good performance, consider using a nightly OpenVINO build: "
55+
f"OpenVINO {display_version}. For good performance, consider using a nightly OpenVINO build: "
4856
"https://docs.openvino.ai/2024/get-started/install-openvino.html. For models that do not need transformers "
4957
"4.38+, it is also an option to downgrade transformers: `pip install transformers==4.37.2`" + COLOR_RESET
5058
)

0 commit comments

Comments
 (0)