Skip to content

Commit 5b4d32e

Browse files
Add compression tests for phi4mm (#1292)
1 parent 3910592 commit 5b4d32e

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

tests/openvino/test_exporters_cli.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,29 @@ class OVCLIExportTestCase(unittest.TestCase):
526526
]
527527
)
528528

529+
if is_transformers_version(">=", "4.49.0"):
530+
TEST_4BIT_CONFIGURATIONS.extend(
531+
[
532+
(
533+
"image-text-to-text",
534+
"phi4mm",
535+
'int4 --group-size 8 --ratio 0.8 --sensitivity-metric "mean_activation_magnitude" '
536+
"--dataset contextual --num-samples 1 --trust-remote-code",
537+
[
538+
{"int8": 8, "int4": 42},
539+
{"int8": 1},
540+
{"int8": 8},
541+
{"int8": 2},
542+
{},
543+
{"int8": 6},
544+
{"int8": 25},
545+
{"int8": 2},
546+
{"int8": 2},
547+
],
548+
),
549+
]
550+
)
551+
529552
def _openvino_export(self, model_name: str, task: str, model_kwargs: Dict = None):
530553
with TemporaryDirectory() as tmpdir:
531554
main_export(model_name_or_path=model_name, output=tmpdir, task=task, model_kwargs=model_kwargs)

tests/openvino/test_quantization.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,37 @@ class OVWeightCompressionTest(unittest.TestCase):
860860
]
861861
)
862862

863+
if is_transformers_version(">=", "4.49.0"):
864+
LOAD_IN_4_BITS_SCOPE.extend(
865+
[
866+
(
867+
OVModelForVisualCausalLM,
868+
"phi4mm",
869+
True,
870+
dict(
871+
bits=4,
872+
group_size=8,
873+
dataset="contextual",
874+
ratio=0.8,
875+
sensitivity_metric="mean_activation_magnitude",
876+
num_samples=1,
877+
trust_remote_code=True,
878+
),
879+
[
880+
{"int8": 8, "int4": 42},
881+
{"int8": 1},
882+
{"int8": 8},
883+
{"int8": 2},
884+
{},
885+
{"int8": 6},
886+
{"int8": 25},
887+
{"int8": 2},
888+
{"int8": 2},
889+
],
890+
),
891+
]
892+
)
893+
863894
SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION = [
864895
(OVModelForCausalLM, "gpt2", False),
865896
(OVModelForMaskedLM, "bert", False),

0 commit comments

Comments
 (0)