Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
16 changes: 13 additions & 3 deletions optimum/exporters/openvino/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2865,12 +2865,22 @@ def with_behavior(
"""
if isinstance(behavior, str) and not isinstance(behavior, MiniCPMVConfigBehavior):
behavior = MiniCPMVConfigBehavior(behavior)

model_mapping = {2.6: "llama", 4.0: "qwen2", 4.5: "qwen3"}
if behavior == MiniCPMVConfigBehavior.TEXT_EMBEDDINGS:
return get_vlm_text_embeddings_config("qwen2", self._orig_config, self.int_dtype, self.float_dtype)
return get_vlm_text_embeddings_config(
model_mapping[self._orig_config.version],
self._orig_config,
self.int_dtype,
self.float_dtype,
)

if behavior == MiniCPMVConfigBehavior.LANGUAGE:
return get_vlm_text_generation_config("qwen2", self._orig_config, self.int_dtype, self.float_dtype)
return get_vlm_text_generation_config(
model_mapping[self._orig_config.version],
self._orig_config,
self.int_dtype,
self.float_dtype,
)

if behavior == MiniCPMVConfigBehavior.VISION_EMBEDDINGS:
return self.__class__(
Expand Down
22 changes: 22 additions & 0 deletions tests/openvino/test_exporters_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,28 @@ class OVCLIExportTestCase(unittest.TestCase):
"resampler_model": {"int8": 6},
},
),
(
"image-text-to-text",
"minicpmv4",
"int4 --group-size 4 --ratio 0.8 --trust-remote-code",
{
"lm_model": {"int8": 12, "int4": 18},
"text_embeddings_model": {"int8": 1},
"vision_embeddings_model": {"int8": 14},
"resampler_model": {"int8": 6},
},
),
(
"image-text-to-text",
"minicpmv4_5",
"int4 --group-size 4 --ratio 0.8 --trust-remote-code",
{
"lm_model": {"int8": 12, "int4": 18},
"text_embeddings_model": {"int8": 1},
"vision_embeddings_model": {"int8": 14},
"resampler_model": {"int8": 6},
},
),
(
"image-text-to-text",
"internvl_chat",
Expand Down
1 change: 1 addition & 0 deletions tests/openvino/test_quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ class OVWeightCompressionTest(unittest.TestCase):

if is_transformers_version(">=", "4.45.0"):
SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION.append((OVModelForVisualCausalLM, "minicpmv", True))
SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION.append((OVModelForVisualCausalLM, "minicpmv4", True))
SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION.append((OVModelForVisualCausalLM, "qwen2_vl", False))

SUPPORTED_ARCHITECTURES_WITH_HYBRID_QUANTIZATION = [
Expand Down
14 changes: 14 additions & 0 deletions tests/openvino/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
"minicpm": "katuni4ka/tiny-random-minicpm",
"minicpm3": "katuni4ka/tiny-random-minicpm3",
"minicpmv": "katuni4ka/tiny-random-minicpmv-2_6",
"minicpmv4": "snake7gun/minicpm-v-4-tiny",
"minicpmv4_5": "snake7gun/tiny-minicpmv-4_5",
Copy link
Collaborator

Choose a reason for hiding this comment

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

158M model size, it makes sense to try to reduce the size

"mistral": "echarlaix/tiny-random-mistral",
"mistral-nemo": "katuni4ka/tiny-random-mistral-nemo",
"mixtral": "TitanML/tiny-mixtral",
Expand Down Expand Up @@ -284,6 +286,18 @@
"vision_embeddings_model": 26,
"resampler_model": 6,
},
"minicpmv4": {
"lm_model": 30,
"text_embeddings_model": 1,
"vision_embeddings_model": 14,
"resampler_model": 6,
},
"minicpmv4_5": {
"lm_model": 30,
"text_embeddings_model": 1,
"vision_embeddings_model": 14,
"resampler_model": 6,
},
"llava_next_video": {
"lm_model": 30,
"text_embeddings_model": 1,
Expand Down
Loading