Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions optimum/exporters/openvino/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3659,9 +3659,6 @@ class M2M100OpenVINOConfig(BartOpenVINOConfig):
pass


@register_in_tasks_manager(
"deepseek_v3", *["text-generation", "text-generation-with-past"], library_name="transformers"
)
@register_in_tasks_manager(
"deepseek_v2", *["text-generation", "text-generation-with-past"], library_name="transformers"
)
Expand All @@ -3671,6 +3668,15 @@ class DeepseekOpenVINOConfig(MiniCPM3OpenVINOConfig):
_MODEL_PATCHER = DeepseekPatcher


@register_in_tasks_manager(
"deepseek_v3", *["text-generation", "text-generation-with-past"], library_name="transformers"
)
class DeepseekVOpenVINOConfig(LlamaOpenVINOConfig):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIN_TRANSFORMERS_VERSION = "4.51.0"
DUMMY_INPUT_GENERATOR_CLASSES = (DummyTextInputGenerator, OVMiniCPM3DummyPastKeyValuesGenerator)
DUMMY_PKV_GENERATOR_CLASS = OVMiniCPM3DummyPastKeyValuesGenerator


@register_in_tasks_manager("got_ocr2", *["image-to-text", "image-text-to-text"], library_name="transformers")
class GotOCR2OpenVINOConfig(BaseVLMOpenVINOConfig):
MIN_TRANSFORMERS_VERSION = "4.49.0"
Expand Down Expand Up @@ -4251,6 +4257,14 @@ def generate_dummy_inputs(self, framework: str = "pt", **kwargs):
return dummy_inputs


@register_in_tasks_manager("ernie4_5", *["text-generation", "text-generation-with-past"], library_name="transformers")
class ErnieOpenVINOConfig(LlamaOpenVINOConfig):
MIN_TRANSFORMERS_VERSION = "4.54.0"
DUMMY_INPUT_GENERATOR_CLASSES = (DummyTextInputGenerator, GemmaDummyPastKeyValuesGenerator)
DUMMY_PKV_GENERATOR_CLASS = GemmaDummyPastKeyValuesGenerator
NORMALIZED_CONFIG_CLASS = NormalizedTextConfig


@register_in_tasks_manager(
"gpt2",
*[
Expand Down
18 changes: 4 additions & 14 deletions tests/openvino/test_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):

if is_transformers_version(">=", "4.46.0"):
SUPPORTED_ARCHITECTURES += ("glm", "mistral-nemo", "minicpm3", "phi3-moe")
# openvino 2025.0 required for disabling check_trace
if is_openvino_version(">=", "2025.0"):
SUPPORTED_ARCHITECTURES += ("deepseek",)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually remote code deepseek_v3 : katuni4ka/tiny-random-deepseek-v3


# gptq and awq install disabled for windows test environment
if platform.system() != "Windows":
Expand All @@ -109,7 +106,7 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
SUPPORTED_ARCHITECTURES += ("gemma3_text",)

if is_transformers_version(">=", "4.51.0"):
SUPPORTED_ARCHITECTURES += ("qwen3", "qwen3_moe")
SUPPORTED_ARCHITECTURES += ("qwen3", "qwen3_moe", "deepseek_v3")

if is_transformers_version(">=", "4.51.3"):
SUPPORTED_ARCHITECTURES += ("glm4",)
Expand All @@ -120,6 +117,7 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
if is_transformers_version(">=", "4.54.0"):
# remote code models differs after transformers v4.54
SUPPORTED_ARCHITECTURES = tuple(set(SUPPORTED_ARCHITECTURES) - {"minicpm", "minicpm3", "arctic", "deepseek"})
SUPPORTED_ARCHITECTURES += ("ernie4_5",)

if is_transformers_version(">=", "4.55.0"):
SUPPORTED_ARCHITECTURES += ("gpt_oss", "gpt_oss_mxfp4")
Expand All @@ -144,7 +142,6 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
"exaone",
"decilm",
"minicpm3",
"deepseek",
)

EXPECTED_NUM_SDPA = {
Expand All @@ -158,6 +155,8 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
"chatglm": 2,
"codegen": 5,
"codegen2": 2,
"deepseek_v3": 2,
"ernie4_5": 4,
"gpt2": 5,
"gptj": 5,
"gpt_neo": 4,
Expand Down Expand Up @@ -202,7 +201,6 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
"mistral-nemo": 8,
"minicpm3": 6,
"phi3-moe": 2,
"deepseek": 2,
"opt_gptq": 12,
"mixtral_awq": 2,
"gemma3_text": 2,
Expand Down Expand Up @@ -324,10 +322,6 @@ def test_compare_to_transformers(self, model_arch):

ov_outputs = ov_model.generate(**tokens, generation_config=gen_config)

# TODO: add back once https://huggingface.co/katuni4ka/tiny-random-minicpm3/discussions/1 merged (for all models) as current mdoeling incompatible with transformers >= v4.49
if model_arch in {"deepseek"} and is_transformers_version(">=", "4.49"):
self.skipTest("Incompatible modeling code")

additional_inputs = {}
# gemma2 does not support dynamic cache, it is unfair to compare dynamic cache result vs hybrid cache,
# align cache representation in torch model
Expand Down Expand Up @@ -569,10 +563,6 @@ def test_beam_search(self, model_arch):
if model_arch in ["qwen", "chatglm", "chatglm4"]:
return

# TODO: add back once https://huggingface.co/katuni4ka/tiny-random-minicpm3/discussions/1 merged (for all models) as current mdoeling incompatible with transformers >= v4.49
if model_arch in {"deepseek"} and is_transformers_version(">=", "4.49"):
self.skipTest("Incompatible modeling code")

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=model_arch in self.REMOTE_CODE_MODELS)
if model_arch == "persimmon":
tokenizer.pad_token_id = tokenizer.bos_token_id
Expand Down
3 changes: 2 additions & 1 deletion tests/openvino/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"deberta": "optimum-intel-internal-testing/tiny-random-deberta",
"deberta-v2": "optimum-intel-internal-testing/tiny-random-DebertaV2Model",
"decilm": "optimum-intel-internal-testing/tiny-random-decilm",
"deepseek": "optimum-intel-internal-testing/tiny-random-deepseek-v3",
"deepseek_v3": "hf-internal-testing/tiny-random-DeepseekV3ForCausalLM",
"deit": "optimum-intel-internal-testing/tiny-random-DeiTModel",
"convnext": "optimum-intel-internal-testing/tiny-random-convnext",
"convnextv2": "optimum-intel-internal-testing/tiny-random-ConvNextV2Model",
Expand All @@ -75,6 +75,7 @@
"donut-swin": "optimum-intel-internal-testing/tiny-random-DonutSwinModel",
"detr": "optimum-intel-internal-testing/tiny-random-DetrModel",
"electra": "optimum-intel-internal-testing/tiny-random-electra",
"ernie4_5": "optimum-internal-testing/tiny-random-Ernie4_5ForCausalLM",
"esm": "optimum-intel-internal-testing/tiny-random-EsmModel",
"exaone": "optimum-intel-internal-testing/tiny-random-exaone",
"gemma": "optimum-intel-internal-testing/tiny-random-GemmaForCausalLM",
Expand Down
Loading