From 02e6dc95bef72018a4bf8ebeb9fc97861708f3f9 Mon Sep 17 00:00:00 2001 From: Nikita Savelyev Date: Thu, 5 Dec 2024 16:13:58 +0100 Subject: [PATCH 1/2] Added compression tests for qwen2-vl --- tests/openvino/test_exporters_cli.py | 7 +++++++ tests/openvino/test_quantization.py | 16 ++++++++++++++++ tests/openvino/utils_tests.py | 1 + 3 files changed, 24 insertions(+) diff --git a/tests/openvino/test_exporters_cli.py b/tests/openvino/test_exporters_cli.py index f94d0f4b5d..38d0a7263c 100644 --- a/tests/openvino/test_exporters_cli.py +++ b/tests/openvino/test_exporters_cli.py @@ -177,6 +177,13 @@ class OVCLIExportTestCase(unittest.TestCase): "--dataset contextual --num-samples 1 --trust-remote-code", {"int8": 4, "int4": 14}, ), + ( + "image-text-to-text", + "qwen2_vl", + 'int4 --group-size 4 --ratio 0.9 --sensitivity-metric "mean_activation_magnitude" ' + "--dataset contextual --num-samples 1 --trust-remote-code", + {"int8": 8, "int4": 22}, + ), ] ) diff --git a/tests/openvino/test_quantization.py b/tests/openvino/test_quantization.py index e97eed5aed..6adcd0a9b0 100644 --- a/tests/openvino/test_quantization.py +++ b/tests/openvino/test_quantization.py @@ -415,6 +415,21 @@ class OVWeightCompressionTest(unittest.TestCase): ), {"int4": 14, "int8": 4}, ), + ( + OVModelForVisualCausalLM, + "qwen2_vl", + True, + dict( + bits=4, + group_size=16, + dataset="contextual", + ratio=0.8, + sensitivity_metric="mean_activation_magnitude", + num_samples=1, + trust_remote_code=True, + ), + {"int4": 20, "int8": 10}, + ), ] ) @@ -439,6 +454,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, "qwen2_vl", False)) SUPPORTED_ARCHITECTURES_WITH_HYBRID_QUANTIZATION = [ (OVStableDiffusionPipeline, "stable-diffusion", 72, 195), diff --git a/tests/openvino/utils_tests.py b/tests/openvino/utils_tests.py index 6571198a94..e37ad5baeb 100644 --- a/tests/openvino/utils_tests.py +++ b/tests/openvino/utils_tests.py @@ -188,6 +188,7 @@ "llava_next": (30, 9, 1), "minicpmv": (30, 26, 1, 6), "nanollava": (30, 15, 1), + "qwen2_vl": (30, 1, 1, 10), } TEST_IMAGE_URL = "http://images.cocodataset.org/val2017/000000039769.jpg" From 14c186f6cd1b7970641a98148f978839177ae4a4 Mon Sep 17 00:00:00 2001 From: Nikita Savelyev Date: Thu, 5 Dec 2024 16:30:15 +0100 Subject: [PATCH 2/2] Remove trust_remote_code --- tests/openvino/test_exporters_cli.py | 2 +- tests/openvino/test_quantization.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/openvino/test_exporters_cli.py b/tests/openvino/test_exporters_cli.py index 38d0a7263c..702eb19c04 100644 --- a/tests/openvino/test_exporters_cli.py +++ b/tests/openvino/test_exporters_cli.py @@ -181,7 +181,7 @@ class OVCLIExportTestCase(unittest.TestCase): "image-text-to-text", "qwen2_vl", 'int4 --group-size 4 --ratio 0.9 --sensitivity-metric "mean_activation_magnitude" ' - "--dataset contextual --num-samples 1 --trust-remote-code", + "--dataset contextual --num-samples 1", {"int8": 8, "int4": 22}, ), ] diff --git a/tests/openvino/test_quantization.py b/tests/openvino/test_quantization.py index 6adcd0a9b0..986cda0c47 100644 --- a/tests/openvino/test_quantization.py +++ b/tests/openvino/test_quantization.py @@ -418,7 +418,7 @@ class OVWeightCompressionTest(unittest.TestCase): ( OVModelForVisualCausalLM, "qwen2_vl", - True, + False, dict( bits=4, group_size=16, @@ -426,7 +426,6 @@ class OVWeightCompressionTest(unittest.TestCase): ratio=0.8, sensitivity_metric="mean_activation_magnitude", num_samples=1, - trust_remote_code=True, ), {"int4": 20, "int8": 10}, ),