Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Nov 27, 2023
1 parent f248835 commit cbdfe1c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions tests/openvino/test_quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def preprocess_function(examples, tokenizer):
class OVWeightCompressionTest(unittest.TestCase):
# TODO : add models
SUPPORTED_ARCHITECTURES_WITH_EXPECTED_COMPRESSED_MATMULS = (
(OVModelForSequenceClassification, "hf-internal-testing/tiny-random-bert", 70, 35),
(OVModelForCausalLM, "hf-internal-testing/tiny-random-BartForCausalLM", 27, 14),
(OVModelForSequenceClassification, "hf-internal-testing/tiny-random-bert", 70, 70),
(OVModelForCausalLM, "hf-internal-testing/tiny-random-gpt2", 45, 44),
)

SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION = (
Expand Down
22 changes: 11 additions & 11 deletions tests/openvino/test_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,30 +318,30 @@ def tearDown(self):
"default_quantization": OVTrainerTestDescriptor(
model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=DEFAULT_QUANTIZATION_CONFIG,
expected_fake_quantize=43,
expected_fake_quantize=42,
expected_int8=32,
compression_metrics=["compression_loss"],
),
"distillation,default_quantization": OVTrainerTestDescriptor(
model_id="hf-internal-testing/tiny-random-bert",
teacher_model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=DEFAULT_QUANTIZATION_CONFIG,
expected_fake_quantize=43,
expected_fake_quantize=42,
expected_int8=32,
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
),
"customized_quantization": OVTrainerTestDescriptor(
model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=CUSTOMIZED_QUANTIZATION_CONFIG,
expected_fake_quantize=70,
expected_fake_quantize=69,
expected_int8=35,
compression_metrics=["compression_loss"],
),
"distillation,customized_quantization": OVTrainerTestDescriptor(
model_id="hf-internal-testing/tiny-random-bert",
teacher_model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=CUSTOMIZED_QUANTIZATION_CONFIG,
expected_fake_quantize=70,
expected_fake_quantize=69,
expected_int8=35,
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
),
Expand Down Expand Up @@ -369,7 +369,7 @@ def tearDown(self):
"customized_quantization,structured_movement_sparsity": OVTrainerTestDescriptor(
model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=[CUSTOMIZED_QUANTIZATION_CONFIG, STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
expected_fake_quantize=70,
expected_fake_quantize=69,
expected_int8=35,
expected_binary_masks=60,
compression_metrics=["compression_loss"],
Expand All @@ -378,7 +378,7 @@ def tearDown(self):
model_id="hf-internal-testing/tiny-random-bert",
teacher_model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=[DEFAULT_QUANTIZATION_CONFIG, STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
expected_fake_quantize=43,
expected_fake_quantize=42,
expected_int8=32,
expected_binary_masks=60,
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
Expand All @@ -387,7 +387,7 @@ def tearDown(self):
model_id="hf-internal-testing/tiny-random-bert",
teacher_model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=[CUSTOMIZED_QUANTIZATION_CONFIG, STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
expected_fake_quantize=70,
expected_fake_quantize=69,
expected_int8=35,
expected_binary_masks=60,
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
Expand All @@ -408,15 +408,15 @@ def tearDown(self):
"default_quantization,unstructured_movement_sparsity": OVTrainerTestDescriptor(
model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=[DEFAULT_QUANTIZATION_CONFIG, UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
expected_fake_quantize=43,
expected_fake_quantize=42,
expected_int8=32,
expected_binary_masks=60,
compression_metrics=["compression_loss"],
),
"customized_quantization,unstructured_movement_sparsity": OVTrainerTestDescriptor(
model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=[CUSTOMIZED_QUANTIZATION_CONFIG, UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
expected_fake_quantize=70,
expected_fake_quantize=69,
expected_int8=35,
expected_binary_masks=60,
compression_metrics=["compression_loss"],
Expand All @@ -425,7 +425,7 @@ def tearDown(self):
model_id="hf-internal-testing/tiny-random-bert",
teacher_model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=[DEFAULT_QUANTIZATION_CONFIG, UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
expected_fake_quantize=43,
expected_fake_quantize=42,
expected_int8=32,
expected_binary_masks=60,
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
Expand All @@ -434,7 +434,7 @@ def tearDown(self):
model_id="hf-internal-testing/tiny-random-bert",
teacher_model_id="hf-internal-testing/tiny-random-bert",
nncf_compression_config=[CUSTOMIZED_QUANTIZATION_CONFIG, UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT],
expected_fake_quantize=70,
expected_fake_quantize=69,
expected_int8=35,
expected_binary_masks=60,
compression_metrics=["compression_loss", "distillation_loss", "task_loss"],
Expand Down
24 changes: 12 additions & 12 deletions tests/openvino/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@


_ARCHITECTURES_TO_EXPECTED_INT8 = {
"bert": (34,),
"roberta": (34,),
"albert": (42,),
"vit": (31,),
"blenderbot": (35,),
"gpt2": (22,),
"wav2vec2": (15,),
"distilbert": (33,),
"t5": (32, 52, 42),
"stable-diffusion": (74, 4, 4, 32),
"stable-diffusion-xl": (148, 4, 4, 33),
"stable-diffusion-xl-refiner": (148, 4, 4, 33),
"bert": (68,),
"roberta": (68,),
"albert": (84,),
"vit": (62,),
"blenderbot": (70,),
"gpt2": (44,),
"wav2vec2": (30,),
"distilbert": (66,),
"t5": (64, 104, 84),
"stable-diffusion": (148, 8, 8, 64),
"stable-diffusion-xl": (296, 8, 8, 66),
"stable-diffusion-xl-refiner": (296, 8, 8, 66),
}


Expand Down

0 comments on commit cbdfe1c

Please sign in to comment.