Skip to content

Commit dea1462

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

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

optimum/exporters/openvino/model_patcher.py

+11-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,18 @@ 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 commit-id only when a nightly/prerelease of OpenVINO is installed.
51+
display_version = (
52+
_openvino_version.split("-")[0] if is_openvino_version("<=", "2024.0.0-14509") else _openvino_version
53+
)
4554
log.warn(
4655
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: "
56+
f"OpenVINO {display_version}. For good performance, consider using a nightly OpenVINO build: "
4857
"https://docs.openvino.ai/2024/get-started/install-openvino.html. For models that do not need transformers "
4958
"4.38+, it is also an option to downgrade transformers: `pip install transformers==4.37.2`" + COLOR_RESET
5059
)

0 commit comments

Comments
 (0)