-
Notifications
You must be signed in to change notification settings - Fork 152
[OpenVINO]add support for minicpmv4/4_5 #1412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 10 commits
4b70b7f
7c64417
4b245f1
81f69be
6974a3e
bd8b41f
6c0c617
05fad58
b4e2ce1
39223a4
bd1adbd
6aec742
f6d7750
a96d993
02a4acf
395b0ca
4aff6ed
09a3f19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2625,12 +2625,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__( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -635,6 +635,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", | ||
|
|
@@ -760,13 +782,13 @@ def _openvino_export(self, model_name: str, task: str, model_kwargs: Dict = None | |
|
|
||
| def test_filtered_architectures(cls): | ||
| if is_transformers_version("<", "4.49"): | ||
| expected = {"llama4", "qwen2_5_vl", "phi4mm"} | ||
| expected = {"llama4", "qwen2_5_vl", "phi4mm", "minicpmv4", "minicpmv4_5"} | ||
| elif is_transformers_version("<", "4.51"): | ||
| expected = {"llama4", "phi4mm"} | ||
| elif is_transformers_version("<", "4.52"): | ||
| expected = set() | ||
| else: | ||
| expected = {"llava-qwen2", "phi3_v", "phi4mm", "minicpmo"} | ||
| expected = {"llava-qwen2", "phi3_v", "phi4mm", "minicpmo", "minicpmv4", "minicpmv4_5"} | ||
|
Comment on lines
767
to
+774
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From this, I get an understanding that minicpmv4/minicpmv4_5 are supported for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont see any limitation on these 2 models. They can share same same version of transformers with minicpm-v-2.6 |
||
|
|
||
| all_model_type = {config[1] for config in cls.TRANSFORMERS_4BIT_CONFIGURATIONS} | ||
| filtered_model_type = {config[1] for config in cls.SUPPORTED_4BIT_CONFIGURATIONS} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use str for versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may i understand why?the version in model's config is a number:
https://huggingface.co/openbmb/MiniCPM-V-4_5/blob/main/config.json#L3
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay I see ! thanks for the clarification.
(it's generally a bad idea to use numbers for versions: 4.0 becomes 4 and 4.10 and 4.1 are the same version 😅)