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