From f20e5b84c31f3423471fe129310415652ada66f7 Mon Sep 17 00:00:00 2001 From: Ella Charlaix <80481427+echarlaix@users.noreply.github.com> Date: Thu, 13 Jun 2024 10:20:21 +0200 Subject: [PATCH] Disable export for arctic for transformers < 4.37.0 (#764) --- optimum/exporters/openvino/model_configs.py | 6 ++++++ tests/openvino/test_modeling.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/optimum/exporters/openvino/model_configs.py b/optimum/exporters/openvino/model_configs.py index f78c58589b..ec1d4805d0 100644 --- a/optimum/exporters/openvino/model_configs.py +++ b/optimum/exporters/openvino/model_configs.py @@ -41,6 +41,7 @@ ) from optimum.utils.normalized_config import NormalizedTextConfig +from ...intel.utils.import_utils import _transformers_version, is_transformers_version from .model_patcher import ( AquilaModelPatcher, ArcticModelPatcher, @@ -818,4 +819,9 @@ class ArcticOpenVINOConfig(MixtralOpenVINOConfig): def patch_model_for_export( self, model: Union["PreTrainedModel", "TFPreTrainedModel"], model_kwargs: Optional[Dict[str, Any]] = None ) -> "ModelPatcher": + if is_transformers_version("<=", "4.36.0"): + raise ValueError( + f"Model patching for Arctic models only available for transformers >= v4.37.0, found {_transformers_version}" + ) + return ArcticModelPatcher(self, model, model_kwargs=model_kwargs) diff --git a/tests/openvino/test_modeling.py b/tests/openvino/test_modeling.py index 5f47114518..a36aae3c51 100644 --- a/tests/openvino/test_modeling.py +++ b/tests/openvino/test_modeling.py @@ -555,7 +555,6 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase): "xverse", "internlm", "jais", - "arctic", ) if is_transformers_version(">=", "4.40.0"): @@ -569,6 +568,7 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase): "cohere", "qwen2", "qwen2-moe", + "arctic", ) GENERATION_LENGTH = 100