@@ -276,24 +276,21 @@ def tearDown(self):
276
276
shutil .rmtree (self .output_dir )
277
277
278
278
279
- TINY_RANDOM_BERT_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
- "BertForSequenceClassification/BertModel[bert]/__rsub___0" ,
293
- "BertForSequenceClassification/BertModel[bert]/__mul___0" ,
294
- "{re}BertLayer\\ [[0-9]+\\ ]/BertAttention\\ [attention\\ ]/BertSelfAttention\\ [self\\ ]/__add___0" ,
295
- ],
296
- }
291
+ "scope_overrides" : {"activations" : {"{re}.*matmul_0" : {"mode" : "asymmetric" }}},
292
+ }
293
+ )
297
294
298
295
STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT = {
299
296
"algorithm" : "movement_sparsity" ,
@@ -339,17 +336,17 @@ def tearDown(self):
339
336
),
340
337
"customized_quantization" : OVTrainerTestDescriptor (
341
338
model_id = "hf-internal-testing/tiny-random-bert" ,
342
- nncf_compression_config = TINY_RANDOM_BERT_CUSTOMIZED_QUANTIZATION_CONFIG ,
343
- expected_fake_quantize = 64 ,
344
- expected_int8 = 35 ,
339
+ nncf_compression_config = CUSTOMIZED_QUANTIZATION_CONFIG ,
340
+ expected_fake_quantize = 44 ,
341
+ expected_int8 = 32 ,
345
342
compression_metrics = ["compression_loss" ],
346
343
),
347
344
"distillation,customized_quantization" : OVTrainerTestDescriptor (
348
345
model_id = "hf-internal-testing/tiny-random-bert" ,
349
346
teacher_model_id = "hf-internal-testing/tiny-random-bert" ,
350
- nncf_compression_config = TINY_RANDOM_BERT_CUSTOMIZED_QUANTIZATION_CONFIG ,
351
- expected_fake_quantize = 64 ,
352
- expected_int8 = 35 ,
347
+ nncf_compression_config = CUSTOMIZED_QUANTIZATION_CONFIG ,
348
+ expected_fake_quantize = 44 ,
349
+ expected_int8 = 32 ,
353
350
compression_metrics = ["compression_loss" , "distillation_loss" , "task_loss" ],
354
351
),
355
352
"structured_movement_sparsity" : OVTrainerTestDescriptor (
@@ -376,11 +373,11 @@ def tearDown(self):
376
373
"customized_quantization,structured_movement_sparsity" : OVTrainerTestDescriptor (
377
374
model_id = "hf-internal-testing/tiny-random-bert" ,
378
375
nncf_compression_config = [
379
- TINY_RANDOM_BERT_CUSTOMIZED_QUANTIZATION_CONFIG ,
376
+ CUSTOMIZED_QUANTIZATION_CONFIG ,
380
377
STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ,
381
378
],
382
- expected_fake_quantize = 64 ,
383
- expected_int8 = 35 ,
379
+ expected_fake_quantize = 44 ,
380
+ expected_int8 = 32 ,
384
381
expected_binary_masks = 60 ,
385
382
compression_metrics = ["compression_loss" ],
386
383
),
@@ -397,11 +394,11 @@ def tearDown(self):
397
394
model_id = "hf-internal-testing/tiny-random-bert" ,
398
395
teacher_model_id = "hf-internal-testing/tiny-random-bert" ,
399
396
nncf_compression_config = [
400
- TINY_RANDOM_BERT_CUSTOMIZED_QUANTIZATION_CONFIG ,
397
+ CUSTOMIZED_QUANTIZATION_CONFIG ,
401
398
STRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ,
402
399
],
403
- expected_fake_quantize = 64 ,
404
- expected_int8 = 35 ,
400
+ expected_fake_quantize = 44 ,
401
+ expected_int8 = 32 ,
405
402
expected_binary_masks = 60 ,
406
403
compression_metrics = ["compression_loss" , "distillation_loss" , "task_loss" ],
407
404
),
@@ -429,11 +426,11 @@ def tearDown(self):
429
426
"customized_quantization,unstructured_movement_sparsity" : OVTrainerTestDescriptor (
430
427
model_id = "hf-internal-testing/tiny-random-bert" ,
431
428
nncf_compression_config = [
432
- TINY_RANDOM_BERT_CUSTOMIZED_QUANTIZATION_CONFIG ,
429
+ CUSTOMIZED_QUANTIZATION_CONFIG ,
433
430
UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ,
434
431
],
435
- expected_fake_quantize = 64 ,
436
- expected_int8 = 35 ,
432
+ expected_fake_quantize = 44 ,
433
+ expected_int8 = 32 ,
437
434
expected_binary_masks = 60 ,
438
435
compression_metrics = ["compression_loss" ],
439
436
),
@@ -450,11 +447,11 @@ def tearDown(self):
450
447
model_id = "hf-internal-testing/tiny-random-bert" ,
451
448
teacher_model_id = "hf-internal-testing/tiny-random-bert" ,
452
449
nncf_compression_config = [
453
- TINY_RANDOM_BERT_CUSTOMIZED_QUANTIZATION_CONFIG ,
450
+ CUSTOMIZED_QUANTIZATION_CONFIG ,
454
451
UNSTRUCTURED_MOVEMENT_SPARSITY_CONFIG_FOR_BERT ,
455
452
],
456
- expected_fake_quantize = 64 ,
457
- expected_int8 = 35 ,
453
+ expected_fake_quantize = 44 ,
454
+ expected_int8 = 32 ,
458
455
expected_binary_masks = 60 ,
459
456
compression_metrics = ["compression_loss" , "distillation_loss" , "task_loss" ],
460
457
),
0 commit comments