@@ -276,20 +276,21 @@ def tearDown(self):
276
276
shutil .rmtree (self .output_dir )
277
277
278
278
279
- CUSTOMIZED_QUANTIZATION_CONFIG = {
280
- "algorithm" : "quantization" ,
281
- "overflow_fix" : "disable" ,
282
- "initializer" : {
283
- "range" : {
284
- "num_init_samples" : 16 ,
285
- "type" : "percentile" ,
286
- "params" : {"min_percentile" : 0.01 , "max_percentile" : 99.99 },
279
+ CUSTOMIZED_QUANTIZATION_CONFIG = deepcopy (DEFAULT_QUANTIZATION_CONFIG )
280
+ CUSTOMIZED_QUANTIZATION_CONFIG .update (
281
+ {
282
+ "overflow_fix" : "disable" ,
283
+ "initializer" : {
284
+ "range" : {
285
+ "num_init_samples" : 16 ,
286
+ "type" : "percentile" ,
287
+ "params" : {"min_percentile" : 0.01 , "max_percentile" : 99.99 },
288
+ },
289
+ "batchnorm_adaptation" : {"num_bn_adaptation_samples" : 4 },
287
290
},
288
- "batchnorm_adaptation" : {"num_bn_adaptation_samples" : 4 },
289
- },
290
- "scope_overrides" : {"activations" : {"{re}.*matmul_0" : {"mode" : "asymmetric" }}},
291
- "ignored_scopes" : [],
292
- }
291
+ "scope_overrides" : {"activations" : {"{re}.*matmul_0" : {"mode" : "asymmetric" }}},
292
+ }
293
+ )
293
294
294
295
STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT = {
295
296
"algorithm" : "movement_sparsity" ,
@@ -336,16 +337,16 @@ def tearDown(self):
336
337
"customized_quantization" : OVTrainerTestDescriptor (
337
338
model_id = "hf-internal-testing/tiny-random-bert" ,
338
339
nncf_compression_config = CUSTOMIZED_QUANTIZATION_CONFIG ,
339
- expected_fake_quantize = 69 ,
340
- expected_int8 = 35 ,
340
+ expected_fake_quantize = 44 ,
341
+ expected_int8 = 32 ,
341
342
compression_metrics = ["compression_loss" ],
342
343
),
343
344
"distillation,customized_quantization" : OVTrainerTestDescriptor (
344
345
model_id = "hf-internal-testing/tiny-random-bert" ,
345
346
teacher_model_id = "hf-internal-testing/tiny-random-bert" ,
346
347
nncf_compression_config = CUSTOMIZED_QUANTIZATION_CONFIG ,
347
- expected_fake_quantize = 69 ,
348
- expected_int8 = 35 ,
348
+ expected_fake_quantize = 44 ,
349
+ expected_int8 = 32 ,
349
350
compression_metrics = ["compression_loss" , "distillation_loss" , "task_loss" ],
350
351
),
351
352
"structured_movement_sparsity" : OVTrainerTestDescriptor (
@@ -371,9 +372,12 @@ def tearDown(self):
371
372
),
372
373
"customized_quantization,structured_movement_sparsity" : OVTrainerTestDescriptor (
373
374
model_id = "hf-internal-testing/tiny-random-bert" ,
374
- nncf_compression_config = [CUSTOMIZED_QUANTIZATION_CONFIG , STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ],
375
- expected_fake_quantize = 69 ,
376
- expected_int8 = 35 ,
375
+ nncf_compression_config = [
376
+ CUSTOMIZED_QUANTIZATION_CONFIG ,
377
+ STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ,
378
+ ],
379
+ expected_fake_quantize = 44 ,
380
+ expected_int8 = 32 ,
377
381
expected_binary_masks = 60 ,
378
382
compression_metrics = ["compression_loss" ],
379
383
),
@@ -389,9 +393,12 @@ def tearDown(self):
389
393
"distillation,customized_quantization,structured_movement_sparsity" : OVTrainerTestDescriptor (
390
394
model_id = "hf-internal-testing/tiny-random-bert" ,
391
395
teacher_model_id = "hf-internal-testing/tiny-random-bert" ,
392
- nncf_compression_config = [CUSTOMIZED_QUANTIZATION_CONFIG , STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ],
393
- expected_fake_quantize = 69 ,
394
- expected_int8 = 35 ,
396
+ nncf_compression_config = [
397
+ CUSTOMIZED_QUANTIZATION_CONFIG ,
398
+ STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ,
399
+ ],
400
+ expected_fake_quantize = 44 ,
401
+ expected_int8 = 32 ,
395
402
expected_binary_masks = 60 ,
396
403
compression_metrics = ["compression_loss" , "distillation_loss" , "task_loss" ],
397
404
),
@@ -418,9 +425,12 @@ def tearDown(self):
418
425
),
419
426
"customized_quantization,unstructured_movement_sparsity" : OVTrainerTestDescriptor (
420
427
model_id = "hf-internal-testing/tiny-random-bert" ,
421
- nncf_compression_config = [CUSTOMIZED_QUANTIZATION_CONFIG , UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ],
422
- expected_fake_quantize = 69 ,
423
- expected_int8 = 35 ,
428
+ nncf_compression_config = [
429
+ CUSTOMIZED_QUANTIZATION_CONFIG ,
430
+ UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ,
431
+ ],
432
+ expected_fake_quantize = 44 ,
433
+ expected_int8 = 32 ,
424
434
expected_binary_masks = 60 ,
425
435
compression_metrics = ["compression_loss" ],
426
436
),
@@ -436,9 +446,12 @@ def tearDown(self):
436
446
"distillation,customized_quantization,unstructured_movement_sparsity" : OVTrainerTestDescriptor (
437
447
model_id = "hf-internal-testing/tiny-random-bert" ,
438
448
teacher_model_id = "hf-internal-testing/tiny-random-bert" ,
439
- nncf_compression_config = [CUSTOMIZED_QUANTIZATION_CONFIG , UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ],
440
- expected_fake_quantize = 69 ,
441
- expected_int8 = 35 ,
449
+ nncf_compression_config = [
450
+ CUSTOMIZED_QUANTIZATION_CONFIG ,
451
+ UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ,
452
+ ],
453
+ expected_fake_quantize = 44 ,
454
+ expected_int8 = 32 ,
442
455
expected_binary_masks = 60 ,
443
456
compression_metrics = ["compression_loss" , "distillation_loss" , "task_loss" ],
444
457
),
0 commit comments