Skip to content

Commit

Permalink
Fix style, show OpenVINO version
Browse files Browse the repository at this point in the history
  • Loading branch information
helena-intel committed Mar 11, 2024
1 parent a85b8aa commit 9fa361e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions optimum/exporters/openvino/model_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import logging as log

from optimum.intel.utils.import_utils import (
_openvino_version,
_torch_version,
_transformers_version,
is_openvino_version,
Expand All @@ -41,10 +42,17 @@ def patch_model_with_bettertransformer(model):
+ COLOR_RESET
)

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

0 comments on commit 9fa361e

Please sign in to comment.