Skip to content

Commit

Permalink
Disable export for arctic for transformers < 4.37.0 (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix authored Jun 13, 2024
1 parent 0486d80 commit f20e5b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions optimum/exporters/openvino/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion tests/openvino/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
"xverse",
"internlm",
"jais",
"arctic",
)

if is_transformers_version(">=", "4.40.0"):
Expand All @@ -569,6 +568,7 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
"cohere",
"qwen2",
"qwen2-moe",
"arctic",
)

GENERATION_LENGTH = 100
Expand Down

0 comments on commit f20e5b8

Please sign in to comment.