Skip to content

Commit d120a45

Browse files
committed
fix quant ops test
1 parent f68b2c7 commit d120a45

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

tests/openvino/test_quantization.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
class OVQuantizerTest(unittest.TestCase):
7676
SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS = (
77-
(OVModelForSequenceClassification, "bert", 32, 35),
77+
(OVModelForSequenceClassification, "bert", 22, 35),
7878
# (OVModelForCausalLM, "gpt2", 41, 23),
7979
)
8080

@@ -663,7 +663,7 @@ def preprocess_function(examples, tokenizer):
663663

664664

665665
class OVTrainerTest(unittest.TestCase):
666-
SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS = (("distilbert-base-uncased", 49, 38),)
666+
SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS = (("distilbert-base-uncased", 67, 38),)
667667

668668
@parameterized.expand(SUPPORTED_ARCHITECTURES_WITH_EXPECTED_QUANTIZED_MATMULS)
669669
def test_aware_training_quantization(self, model_name, expected_fake_quantize, expected_int8):

tests/openvino/test_training.py

+22-22
Original file line numberDiff line numberDiff line change
@@ -322,30 +322,30 @@ def tearDown(self):
322322
"default_quantization": OVTrainerTestDescriptor(
323323
model_id="hf-internal-testing/tiny-random-bert",
324324
nncf_compression_config=DEFAULT_QUANTIZATION_CONFIG,
325-
expected_fake_quantize=34,
325+
expected_fake_quantize=22,
326326
expected_int8=32,
327327
compression_metrics=["compression_loss"],
328328
),
329329
"distillation,default_quantization": OVTrainerTestDescriptor(
330330
model_id="hf-internal-testing/tiny-random-bert",
331331
teacher_model_id="hf-internal-testing/tiny-random-bert",
332332
nncf_compression_config=DEFAULT_QUANTIZATION_CONFIG,
333-
expected_fake_quantize=34,
333+
expected_fake_quantize=22,
334334
expected_int8=32,
335335
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
336336
),
337337
"customized_quantization": OVTrainerTestDescriptor(
338338
model_id="hf-internal-testing/tiny-random-bert",
339339
nncf_compression_config=CUSTOMIZED_QUANTIZATION_CONFIG,
340-
expected_fake_quantize=34,
340+
expected_fake_quantize=22,
341341
expected_int8=32,
342342
compression_metrics=["compression_loss"],
343343
),
344344
"distillation,customized_quantization": OVTrainerTestDescriptor(
345345
model_id="hf-internal-testing/tiny-random-bert",
346346
teacher_model_id="hf-internal-testing/tiny-random-bert",
347347
nncf_compression_config=CUSTOMIZED_QUANTIZATION_CONFIG,
348-
expected_fake_quantize=34,
348+
expected_fake_quantize=22,
349349
expected_int8=32,
350350
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
351351
),
@@ -365,7 +365,7 @@ def tearDown(self):
365365
"default_quantization,structured_movement_sparsity": OVTrainerTestDescriptor(
366366
model_id="hf-internal-testing/tiny-random-bert",
367367
nncf_compression_config=[DEFAULT_QUANTIZATION_CONFIG, STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
368-
expected_fake_quantize=34,
368+
expected_fake_quantize=22,
369369
expected_int8=32,
370370
expected_binary_masks=60,
371371
compression_metrics=["compression_loss"],
@@ -376,7 +376,7 @@ def tearDown(self):
376376
CUSTOMIZED_QUANTIZATION_CONFIG,
377377
STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT,
378378
],
379-
expected_fake_quantize=34,
379+
expected_fake_quantize=22,
380380
expected_int8=32,
381381
expected_binary_masks=60,
382382
compression_metrics=["compression_loss"],
@@ -385,7 +385,7 @@ def tearDown(self):
385385
model_id="hf-internal-testing/tiny-random-bert",
386386
teacher_model_id="hf-internal-testing/tiny-random-bert",
387387
nncf_compression_config=[DEFAULT_QUANTIZATION_CONFIG, STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
388-
expected_fake_quantize=34,
388+
expected_fake_quantize=22,
389389
expected_int8=32,
390390
expected_binary_masks=60,
391391
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
@@ -397,7 +397,7 @@ def tearDown(self):
397397
CUSTOMIZED_QUANTIZATION_CONFIG,
398398
STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT,
399399
],
400-
expected_fake_quantize=34,
400+
expected_fake_quantize=22,
401401
expected_int8=32,
402402
expected_binary_masks=60,
403403
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
@@ -418,7 +418,7 @@ def tearDown(self):
418418
"default_quantization,unstructured_movement_sparsity": OVTrainerTestDescriptor(
419419
model_id="hf-internal-testing/tiny-random-bert",
420420
nncf_compression_config=[DEFAULT_QUANTIZATION_CONFIG, UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
421-
expected_fake_quantize=34,
421+
expected_fake_quantize=22,
422422
expected_int8=32,
423423
expected_binary_masks=60,
424424
compression_metrics=["compression_loss"],
@@ -429,7 +429,7 @@ def tearDown(self):
429429
CUSTOMIZED_QUANTIZATION_CONFIG,
430430
UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT,
431431
],
432-
expected_fake_quantize=34,
432+
expected_fake_quantize=22,
433433
expected_int8=32,
434434
expected_binary_masks=60,
435435
compression_metrics=["compression_loss"],
@@ -438,7 +438,7 @@ def tearDown(self):
438438
model_id="hf-internal-testing/tiny-random-bert",
439439
teacher_model_id="hf-internal-testing/tiny-random-bert",
440440
nncf_compression_config=[DEFAULT_QUANTIZATION_CONFIG, UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
441-
expected_fake_quantize=34,
441+
expected_fake_quantize=22,
442442
expected_int8=32,
443443
expected_binary_masks=60,
444444
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
@@ -450,7 +450,7 @@ def tearDown(self):
450450
CUSTOMIZED_QUANTIZATION_CONFIG,
451451
UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT,
452452
],
453-
expected_fake_quantize=34,
453+
expected_fake_quantize=22,
454454
expected_int8=32,
455455
expected_binary_masks=60,
456456
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
@@ -553,7 +553,7 @@ def check_ovmodel_reshaping(self, ovmodel: OVModel):
553553
"default_quantization": OVTrainerTestDescriptor(
554554
model_id="yujiepan/tiny-random-swin-patch4-window7-224",
555555
nncf_compression_config=DEFAULT_QUANTIZATION_CONFIG,
556-
expected_fake_quantize=28,
556+
expected_fake_quantize=36,
557557
expected_int8=28,
558558
compression_metrics=["compression_loss"],
559559
),
@@ -572,15 +572,15 @@ def check_ovmodel_reshaping(self, ovmodel: OVModel):
572572
"default_quantization,structured_movement_sparsity": OVTrainerTestDescriptor(
573573
model_id="yujiepan/tiny-random-swin-patch4-window7-224",
574574
nncf_compression_config=[STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_SWIN, DEFAULT_QUANTIZATION_CONFIG],
575-
expected_fake_quantize=28,
575+
expected_fake_quantize=36,
576576
expected_int8=28,
577577
expected_binary_masks=48,
578578
compression_metrics=["compression_loss"],
579579
),
580580
"default_quantization,unstructured_movement_sparsity": OVTrainerTestDescriptor(
581581
model_id="yujiepan/tiny-random-swin-patch4-window7-224",
582582
nncf_compression_config=[UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_SWIN, DEFAULT_QUANTIZATION_CONFIG],
583-
expected_fake_quantize=28,
583+
expected_fake_quantize=36,
584584
expected_int8=28,
585585
expected_binary_masks=48,
586586
compression_metrics=["compression_loss"],
@@ -589,7 +589,7 @@ def check_ovmodel_reshaping(self, ovmodel: OVModel):
589589
model_id="yujiepan/tiny-random-swin-patch4-window7-224",
590590
teacher_model_id="yujiepan/tiny-random-swin-patch4-window7-224",
591591
nncf_compression_config=[STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_SWIN, DEFAULT_QUANTIZATION_CONFIG],
592-
expected_fake_quantize=28,
592+
expected_fake_quantize=36,
593593
expected_int8=28,
594594
expected_binary_masks=48,
595595
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
@@ -598,7 +598,7 @@ def check_ovmodel_reshaping(self, ovmodel: OVModel):
598598
model_id="yujiepan/tiny-random-swin-patch4-window7-224",
599599
teacher_model_id="yujiepan/tiny-random-swin-patch4-window7-224",
600600
nncf_compression_config=[UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_SWIN, DEFAULT_QUANTIZATION_CONFIG],
601-
expected_fake_quantize=28,
601+
expected_fake_quantize=36,
602602
expected_int8=28,
603603
expected_binary_masks=48,
604604
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
@@ -730,7 +730,7 @@ def check_ovmodel_reshaping(self, ovmodel: OVModel):
730730
"quantization": OVTrainerTestDescriptor(
731731
model_id="hf-internal-testing/tiny-random-Wav2Vec2Model",
732732
nncf_compression_config=[QUANTIZATION_CONFIG_FOR_WAV2VEC2],
733-
expected_fake_quantize=40,
733+
expected_fake_quantize=24,
734734
expected_int8=30,
735735
compression_metrics=["compression_loss"],
736736
),
@@ -749,15 +749,15 @@ def check_ovmodel_reshaping(self, ovmodel: OVModel):
749749
"quantization,structured_movement_sparsity": OVTrainerTestDescriptor(
750750
model_id="hf-internal-testing/tiny-random-Wav2Vec2Model",
751751
nncf_compression_config=[QUANTIZATION_CONFIG_FOR_WAV2VEC2, STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_WAV2VEC2],
752-
expected_fake_quantize=40,
752+
expected_fake_quantize=24,
753753
expected_int8=30,
754754
expected_binary_masks=48,
755755
compression_metrics=["compression_loss"],
756756
),
757757
"quantization,unstructured_movement_sparsity": OVTrainerTestDescriptor(
758758
model_id="hf-internal-testing/tiny-random-Wav2Vec2Model",
759759
nncf_compression_config=[QUANTIZATION_CONFIG_FOR_WAV2VEC2, UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_WAV2VEC2],
760-
expected_fake_quantize=40,
760+
expected_fake_quantize=24,
761761
expected_int8=30,
762762
expected_binary_masks=48,
763763
compression_metrics=["compression_loss"],
@@ -766,7 +766,7 @@ def check_ovmodel_reshaping(self, ovmodel: OVModel):
766766
model_id="hf-internal-testing/tiny-random-Wav2Vec2Model",
767767
teacher_model_id="hf-internal-testing/tiny-random-Wav2Vec2Model",
768768
nncf_compression_config=[QUANTIZATION_CONFIG_FOR_WAV2VEC2, STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_WAV2VEC2],
769-
expected_fake_quantize=40,
769+
expected_fake_quantize=24,
770770
expected_int8=30,
771771
expected_binary_masks=48,
772772
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
@@ -775,7 +775,7 @@ def check_ovmodel_reshaping(self, ovmodel: OVModel):
775775
model_id="hf-internal-testing/tiny-random-Wav2Vec2Model",
776776
teacher_model_id="hf-internal-testing/tiny-random-Wav2Vec2Model",
777777
nncf_compression_config=[QUANTIZATION_CONFIG_FOR_WAV2VEC2, UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_WAV2VEC2],
778-
expected_fake_quantize=40,
778+
expected_fake_quantize=24,
779779
expected_int8=30,
780780
expected_binary_masks=48,
781781
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],

0 commit comments

Comments
 (0)