|
63 | 63 | OVWeightQuantizationConfig,
|
64 | 64 | OVDynamicQuantizationConfig,
|
65 | 65 | OVModelOpenCLIPForZeroShotImageClassification,
|
| 66 | + OVModelForVisualCausalLM, |
66 | 67 | )
|
67 | 68 | from optimum.intel.openvino.configuration import (
|
68 | 69 | OVQuantizationMethod,
|
@@ -298,6 +299,7 @@ class OVWeightCompressionTest(unittest.TestCase):
|
298 | 299 | (OVStableDiffusionPipeline, "stable-diffusion"),
|
299 | 300 | (OVStableDiffusionXLPipeline, "stable-diffusion-xl"),
|
300 | 301 | (OVModelOpenCLIPForZeroShotImageClassification, "open-clip"),
|
| 302 | + (OVModelForVisualCausalLM, "llava"), |
301 | 303 | )
|
302 | 304 |
|
303 | 305 | SUPPORTED_ARCHITECTURES_WITH_HYBRID_QUANTIZATION = (
|
@@ -439,6 +441,9 @@ def test_ovmodel_load_with_compressed_weights(self, model_cls, model_type):
|
439 | 441 | models.append(model.text_encoder if model_type == "stable-diffusion" else model.text_encoder_2)
|
440 | 442 | elif model_type == "open-clip":
|
441 | 443 | models = [model.text_model, model.visual_model]
|
| 444 | + elif model.export_feature == "image-text-to-text": |
| 445 | + models = [model.lm_model, model.vision_embeddings_model, model.text_embeddings_model] |
| 446 | + models += [getattr(model, part) for part in model.additional_parts] |
442 | 447 | else:
|
443 | 448 | models = [model]
|
444 | 449 |
|
@@ -528,16 +533,16 @@ def test_ovmodel_4bit_auto_compression_with_config(
|
528 | 533 | # TODO: Check that AWQ was actually applied
|
529 | 534 | pass
|
530 | 535 |
|
531 |
| - tokenizer = AutoTokenizer.from_pretrained(model_id) |
532 |
| - if tokenizer.pad_token is None: |
533 |
| - tokenizer.pad_token = tokenizer.eos_token |
| 536 | + ov_model = model |
| 537 | + if model_cls == OVModelForVisualCausalLM: |
| 538 | + ov_model = model.lm_model |
534 | 539 |
|
535 |
| - _, num_weight_nodes = get_num_quantized_nodes(model) |
| 540 | + _, num_weight_nodes = get_num_quantized_nodes(ov_model) |
536 | 541 | expected_num_weight_nodes.update({k: 0 for k in set(num_weight_nodes) - set(expected_num_weight_nodes)})
|
537 | 542 | self.assertEqual(expected_num_weight_nodes, num_weight_nodes)
|
538 | 543 | model.save_pretrained(tmp_dir)
|
539 | 544 |
|
540 |
| - wc_rt_info = model.model.get_rt_info()["nncf"]["weight_compression"] |
| 545 | + wc_rt_info = ov_model.get_rt_info()["nncf"]["weight_compression"] |
541 | 546 | self.assertEqual(quantization_config.quant_method.lower() == "awq", wc_rt_info["awq"].value == "True")
|
542 | 547 | self.assertEqual(
|
543 | 548 | quantization_config.scale_estimation or False, wc_rt_info["scale_estimation"].value == "True"
|
@@ -568,6 +573,9 @@ def test_ovmodel_load_with_uncompressed_weights(self, model_cls, model_type):
|
568 | 573 | models.append(model.text_encoder if model_type == "stable-diffusion" else model.text_encoder_2)
|
569 | 574 | elif model_type == "open-clip":
|
570 | 575 | models = [model.text_model, model.visual_model]
|
| 576 | + elif model.export_feature == "image-text-to-text": |
| 577 | + models = [model.lm_model, model.vision_embeddings_model, model.text_embeddings_model] |
| 578 | + models += [getattr(model, part) for part in model.additional_parts] |
571 | 579 | else:
|
572 | 580 | models = [model]
|
573 | 581 |
|
|
0 commit comments