mct-nightly 2.1.0.20240730.436__py3-none-any.whl → 2.1.0.20240801.515__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {mct_nightly-2.1.0.20240730.436.dist-info → mct_nightly-2.1.0.20240801.515.dist-info}/METADATA +1 -1
  2. {mct_nightly-2.1.0.20240730.436.dist-info → mct_nightly-2.1.0.20240801.515.dist-info}/RECORD +27 -27
  3. model_compression_toolkit/__init__.py +1 -1
  4. model_compression_toolkit/core/common/framework_implementation.py +5 -9
  5. model_compression_toolkit/core/common/graph/base_graph.py +1 -23
  6. model_compression_toolkit/core/common/graph/base_node.py +2 -28
  7. model_compression_toolkit/core/common/mixed_precision/sensitivity_evaluation.py +12 -12
  8. model_compression_toolkit/core/common/quantization/candidate_node_quantization_config.py +2 -2
  9. model_compression_toolkit/core/common/quantization/node_quantization_config.py +16 -38
  10. model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_weights_computation.py +5 -27
  11. model_compression_toolkit/core/common/quantization/quantizers/quantizers_helpers.py +1 -65
  12. model_compression_toolkit/core/keras/back2framework/factory_model_builder.py +3 -3
  13. model_compression_toolkit/core/keras/keras_implementation.py +21 -17
  14. model_compression_toolkit/core/keras/tf_tensor_numpy.py +2 -2
  15. model_compression_toolkit/core/pytorch/back2framework/factory_model_builder.py +3 -3
  16. model_compression_toolkit/core/pytorch/pytorch_implementation.py +15 -14
  17. model_compression_toolkit/core/pytorch/reader/node_holders.py +1 -1
  18. model_compression_toolkit/core/runner.py +1 -0
  19. model_compression_toolkit/exporter/model_wrapper/keras/validate_layer.py +2 -2
  20. model_compression_toolkit/gptq/common/gptq_training.py +0 -35
  21. model_compression_toolkit/qat/keras/quantizer/base_keras_qat_quantizer.py +1 -1
  22. model_compression_toolkit/qat/pytorch/quantizer/base_pytorch_qat_quantizer.py +1 -1
  23. model_compression_toolkit/target_platform_capabilities/target_platform/op_quantization_config.py +7 -6
  24. model_compression_toolkit/target_platform_capabilities/target_platform/target_platform_model.py +2 -2
  25. {mct_nightly-2.1.0.20240730.436.dist-info → mct_nightly-2.1.0.20240801.515.dist-info}/LICENSE.md +0 -0
  26. {mct_nightly-2.1.0.20240730.436.dist-info → mct_nightly-2.1.0.20240801.515.dist-info}/WHEEL +0 -0
  27. {mct_nightly-2.1.0.20240730.436.dist-info → mct_nightly-2.1.0.20240801.515.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mct-nightly
3
- Version: 2.1.0.20240730.436
3
+ Version: 2.1.0.20240801.515
4
4
  Summary: A Model Compression Toolkit for neural networks
5
5
  Home-page: UNKNOWN
6
6
  License: UNKNOWN
@@ -1,4 +1,4 @@
1
- model_compression_toolkit/__init__.py,sha256=sHb21l7q6uqdrtwQFDGXqUI66hhGFmew2OkJQTS7eZc,1573
1
+ model_compression_toolkit/__init__.py,sha256=-L1xPY1BvoKlBh8WD3EKn_XFs0oLG-nuiSLnyOVxbfU,1573
2
2
  model_compression_toolkit/constants.py,sha256=9pVleMwnhlM4QwIL2HcEq42I1uF4rlSw63RUjkxOF4w,3923
3
3
  model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
4
4
  model_compression_toolkit/logger.py,sha256=3DByV41XHRR3kLTJNbpaMmikL8icd9e1N-nkQAY9oDk,4567
@@ -7,10 +7,10 @@ model_compression_toolkit/core/__init__.py,sha256=TrRgkWpT1AN2Faw1M_1HXyJkJnbxfn
7
7
  model_compression_toolkit/core/analyzer.py,sha256=X-2ZpkH1xdXnISnw1yJvXnvV-ssoUh-9LkLISSWNqiY,3691
8
8
  model_compression_toolkit/core/graph_prep_runner.py,sha256=kM70wmNG3yMFiGQc0uO0wn9j4ZbSWxUEykpxDK55doc,10567
9
9
  model_compression_toolkit/core/quantization_prep_runner.py,sha256=K9eJ7VbB_rpeyxX4yEnorOmSxFW3DkvofzxS6QI8Hp8,6454
10
- model_compression_toolkit/core/runner.py,sha256=4TtOgyNb4cXr52dOlDqYxLm3rnLR6uHPDNoZiEFL9XA,12655
10
+ model_compression_toolkit/core/runner.py,sha256=JvX0Ht164BOKIsPPxp6z-Nlk1Vlhlg7wKBl6lc2yIaQ,12675
11
11
  model_compression_toolkit/core/common/__init__.py,sha256=Wh127PbXcETZX_d1PQqZ71ETK3J9XO5A-HpadGUbj6o,1447
12
12
  model_compression_toolkit/core/common/base_substitutions.py,sha256=xDFSmVVs_iFSZfajytI0cuQaNRNcwHX3uqOoHgVUvxQ,1666
13
- model_compression_toolkit/core/common/framework_implementation.py,sha256=zg2Sznd-uqpN8hy9C22jah_27qPYXNajYx3xMR3AlMw,20938
13
+ model_compression_toolkit/core/common/framework_implementation.py,sha256=kSg2f7wS7e2EyvX6y0eKfNTTFvVFVrB8lvldJvcPvN8,20724
14
14
  model_compression_toolkit/core/common/framework_info.py,sha256=1ZMMGS9ip-kSflqkartyNRt9aQ5ub1WepuTRcTy-YSQ,6337
15
15
  model_compression_toolkit/core/common/memory_computation.py,sha256=ixoSpV5ZYZGyzhre3kQcvR2sNA8KBsPZ3lgbkDnw9Cs,1205
16
16
  model_compression_toolkit/core/common/model_builder_mode.py,sha256=jll9-59OPaE3ug7Y9-lLyV99_FoNHxkGZMgcm0Vkpss,1324
@@ -30,8 +30,8 @@ model_compression_toolkit/core/common/collectors/statistics_collector.py,sha256=
30
30
  model_compression_toolkit/core/common/fusion/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
31
31
  model_compression_toolkit/core/common/fusion/layer_fusing.py,sha256=lOubqpc18TslhXZijWUJQAa1c3jIB2S-M-5HK78wJPQ,5548
32
32
  model_compression_toolkit/core/common/graph/__init__.py,sha256=Xr-Lt_qXMdrCnnOaUS_OJP_3iTTGfPCLf8_vSrQgCs0,773
33
- model_compression_toolkit/core/common/graph/base_graph.py,sha256=lmIw0srKiwCvz7KWqfwKTxyQHDy3s6rWMIXzFAa1UMo,38326
34
- model_compression_toolkit/core/common/graph/base_node.py,sha256=Hqv5lsEYT2uz5FYAX44Rsps_Ax73_kVoXy_DNaXIddU,29448
33
+ model_compression_toolkit/core/common/graph/base_graph.py,sha256=lg5QaBkRbmvM3tGZ0Q34S3m0CbFql3LUv5BaXLe5TG8,37824
34
+ model_compression_toolkit/core/common/graph/base_node.py,sha256=Hwp5QiAa79TD1Y4KM8Uit7SrJ081QRGCooDIkenYuTs,28494
35
35
  model_compression_toolkit/core/common/graph/edge.py,sha256=buoSEUZwilWBK3WeBKpJ-GeDaUA1SDdOHxDpxU_bGpk,3784
36
36
  model_compression_toolkit/core/common/graph/functional_node.py,sha256=XvzydBSRxgpYdKS-aYVaWtH3FDzJPKGad3bai9wF3BI,3956
37
37
  model_compression_toolkit/core/common/graph/graph_matchers.py,sha256=CrDoHYq4iPaflgJWmoJ1K4ziLrRogJvFTVWg8P0UcDU,4744
@@ -64,7 +64,7 @@ model_compression_toolkit/core/common/mixed_precision/distance_weighting.py,sha2
64
64
  model_compression_toolkit/core/common/mixed_precision/mixed_precision_quantization_config.py,sha256=rppRZJdSCQGiZsd93QxoUIhj51eETvQbuI5JiC2TUeA,4963
65
65
  model_compression_toolkit/core/common/mixed_precision/mixed_precision_search_facade.py,sha256=pk8HRoShDhiUprBC4m1AFQv1SacS4hOrj0MRdbq-5gY,7556
66
66
  model_compression_toolkit/core/common/mixed_precision/mixed_precision_search_manager.py,sha256=TTTux4YiOnQqt-2h7Y38959XaDwNZc0eufLMx_yws5U,37578
67
- model_compression_toolkit/core/common/mixed_precision/sensitivity_evaluation.py,sha256=PNGWP0bPkQNP1jCORP6FQgGIr616Kg1YSe_hy-BDg0I,27546
67
+ model_compression_toolkit/core/common/mixed_precision/sensitivity_evaluation.py,sha256=QdxFQ0JxsrcSfk5LlUU_3oZpEK7bYwKelGzEHh0mnJY,27558
68
68
  model_compression_toolkit/core/common/mixed_precision/set_layer_to_bitwidth.py,sha256=P8QtKgFXtt5b2RoubzI5OGlCfbEfZsAirjyrkFzK26A,2846
69
69
  model_compression_toolkit/core/common/mixed_precision/solution_refinement_procedure.py,sha256=KifDMbm7qkSfvSl6pcZzQ82naIXzeKL6aT-VsvWZYyc,7901
70
70
  model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
@@ -97,11 +97,11 @@ model_compression_toolkit/core/common/pruning/mask/__init__.py,sha256=huHoBUcKNB
97
97
  model_compression_toolkit/core/common/pruning/mask/per_channel_mask.py,sha256=APY8BsM9B7ZxVCH6n1xs9fSCTB_A9ou9gHrCQl1DOdI,5131
98
98
  model_compression_toolkit/core/common/pruning/mask/per_simd_group_mask.py,sha256=4ohJrJHNzZk5uMnZEYkwLx2TDGzkh5kRhLGNVYNC6dc,5978
99
99
  model_compression_toolkit/core/common/quantization/__init__.py,sha256=sw7LOPN1bM82o3SkMaklyH0jw-TLGK0-fl2Wq73rffI,697
100
- model_compression_toolkit/core/common/quantization/candidate_node_quantization_config.py,sha256=8RfAaVITnYpWQUvFnDDzLOteBtc5bN6JOzdyb-l768U,4900
100
+ model_compression_toolkit/core/common/quantization/candidate_node_quantization_config.py,sha256=yU-Cr6S4wOSkDk57iH2NVe-WII0whOhLryejkomCOt4,4940
101
101
  model_compression_toolkit/core/common/quantization/core_config.py,sha256=KYdyfSmjSL4ye24nKlC_c4_AxYb14qoqaeMnZj4-8kE,2257
102
102
  model_compression_toolkit/core/common/quantization/debug_config.py,sha256=HtkMmneN-EmAzgZK4Vp4M8Sqm5QKdrvNyyZMpaVqYzY,1482
103
103
  model_compression_toolkit/core/common/quantization/filter_nodes_candidates.py,sha256=fwF4VILaX-u3ZaFd81xjbJuhg8Ef-JX_KfMXW0TPV-I,7136
104
- model_compression_toolkit/core/common/quantization/node_quantization_config.py,sha256=u0JkdRqBXG0RvvYyLyvYknEVtB2-gxpqUJnUw3loLmE,26851
104
+ model_compression_toolkit/core/common/quantization/node_quantization_config.py,sha256=QivClAel7O9k1RkM25Kp_bhB7otq0ZKlxDAF0nQIT6Q,26351
105
105
  model_compression_toolkit/core/common/quantization/quantization_config.py,sha256=du0VdsxfkOSYaP1EU9gHA5qbXpfQNZL0jXrjk1wBA0U,7106
106
106
  model_compression_toolkit/core/common/quantization/quantization_fn_selection.py,sha256=eyosbVdnCwed7oMQ19tqnh0VoyGZ_UAuD_UnNoXyBpo,2210
107
107
  model_compression_toolkit/core/common/quantization/quantization_params_fn_selection.py,sha256=MwIOBZ4BlZSTIOG75PDvlI3JmZ6t8YjPc1VP9Adei60,3847
@@ -116,12 +116,12 @@ model_compression_toolkit/core/common/quantization/quantization_params_generatio
116
116
  model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_activations_computation.py,sha256=noEdvGiyyW7acgQ2OFWLedCODibTGYJifC9qo8YIU5U,4558
117
117
  model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_computation.py,sha256=oME8T6Slgl1SJNpXV4oY3UhuX0YmKYbcWDsLiCYq7oE,8651
118
118
  model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_search.py,sha256=o2XNY_0pUUyId02TUVQBtkux_i40NCcnzuobSeQLy3E,42863
119
- model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_weights_computation.py,sha256=zSNda0jN8cP41m6g5TOv5WvATwIhV8z6AVM1Es6rq1s,4419
119
+ model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_weights_computation.py,sha256=UI-NW9K-yA6qxtk3Uin1wKmo59FNy0LUnySpxodgeEs,3796
120
120
  model_compression_toolkit/core/common/quantization/quantization_params_generation/symmetric_selection.py,sha256=4TP41wPYC0azIzFxUt-lNlKUPIIXQeE4H1SYHkON75k,11875
121
121
  model_compression_toolkit/core/common/quantization/quantization_params_generation/uniform_selection.py,sha256=E83BU4wZEOY-Q-HTo04ABftv22Y6fWEdNYkGA-MZLMU,10494
122
122
  model_compression_toolkit/core/common/quantization/quantizers/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7VclGVOQ63x2p6mAAuba4,698
123
123
  model_compression_toolkit/core/common/quantization/quantizers/lut_kmeans_quantizer.py,sha256=P0x_y18LypBxP2tV9OWizheYfILqvaMC8RwHo04sUpQ,2761
124
- model_compression_toolkit/core/common/quantization/quantizers/quantizers_helpers.py,sha256=CCFhi5LUIcHCCIzDyORvm0FDZLknrctdNwNlPphOQgI,14245
124
+ model_compression_toolkit/core/common/quantization/quantizers/quantizers_helpers.py,sha256=iEoWUPFQMcvZXHtLMe2_7L7IK25XcKiY6-d1_gArZs0,11880
125
125
  model_compression_toolkit/core/common/quantization/quantizers/uniform_quantizers.py,sha256=wXExWHf5-0He7L4bpvFpKlx7FG4u3DAfNZiXPpOs_SQ,5521
126
126
  model_compression_toolkit/core/common/statistics_correction/__init__.py,sha256=sw7LOPN1bM82o3SkMaklyH0jw-TLGK0-fl2Wq73rffI,697
127
127
  model_compression_toolkit/core/common/statistics_correction/apply_bias_correction_to_graph.py,sha256=xSWVDOODgbN0k4mjJWWtpawilOsqdm4O7Uw2hbA75EA,4669
@@ -150,13 +150,13 @@ model_compression_toolkit/core/keras/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7V
150
150
  model_compression_toolkit/core/keras/constants.py,sha256=Uv3c0UdW55pIVQNW_1HQlgl-dHXREkltOLyzp8G1mTQ,3163
151
151
  model_compression_toolkit/core/keras/custom_layer_validation.py,sha256=f-b14wuiIgitBe7d0MmofYhDCTO3IhwJgwrh-Hq_t_U,1192
152
152
  model_compression_toolkit/core/keras/default_framework_info.py,sha256=HcHplb7IcnOTyK2p6uhp3OVG4-RV3RDo9C_4evaIzkQ,4981
153
- model_compression_toolkit/core/keras/keras_implementation.py,sha256=qrmFzs749gVCEanw-paEsbM50zECtMV8qDMxKFTmyj0,29906
153
+ model_compression_toolkit/core/keras/keras_implementation.py,sha256=hzNC6wz1gtL2EqmRCMCQYl8AqIDJPu6rdOX6nvPgjCM,30193
154
154
  model_compression_toolkit/core/keras/keras_model_validation.py,sha256=1wNV2clFdC9BzIELRLSO2uKf0xqjLqlkTJudwtCeaJk,1722
155
155
  model_compression_toolkit/core/keras/keras_node_prior_info.py,sha256=HUmzEXDQ8LGX7uOYSRiLZ2TNbYxLX9J9IeAa6QYlifg,3927
156
156
  model_compression_toolkit/core/keras/resource_utilization_data_facade.py,sha256=Xmk2ZL5CaYdb7iG62HdtZ1F64vap7ffnrsuR3e3G5hc,4851
157
- model_compression_toolkit/core/keras/tf_tensor_numpy.py,sha256=moMFP7hOagAbd09bWa2AX5uxN7XOJqLB-mV3mA30kLQ,2651
157
+ model_compression_toolkit/core/keras/tf_tensor_numpy.py,sha256=AJMPD_cAwf7nzTlLMf_Y1kofXkh_xm8Ji7J6yDpbAKc,2691
158
158
  model_compression_toolkit/core/keras/back2framework/__init__.py,sha256=rhIiXg_nBgUZ-baE3M6SzCuQbcnq4iebY1jtJBvKHOM,808
159
- model_compression_toolkit/core/keras/back2framework/factory_model_builder.py,sha256=urpfyHvIzD08QzPBWusVBT_dKZ8ZUf1I1zIQNb4qe5Y,2233
159
+ model_compression_toolkit/core/keras/back2framework/factory_model_builder.py,sha256=UIQgOOdexycrSKombTMJVvTthR7MlrCihoqM8Kg-rnE,2293
160
160
  model_compression_toolkit/core/keras/back2framework/float_model_builder.py,sha256=9SFHhX-JnkB8PvYIIHRYlReBDI_RkZY9LditzW_ElLk,2444
161
161
  model_compression_toolkit/core/keras/back2framework/instance_builder.py,sha256=fBj13c6zkVoWX4JJG18_uXPptiEJqXClE_zFbaFB6Q8,4517
162
162
  model_compression_toolkit/core/keras/back2framework/keras_model_builder.py,sha256=XFSSaET4oPWB_cx-Q_c9pDJfWyQ1qXT9JXBl5FJCTa4,18137
@@ -213,12 +213,12 @@ model_compression_toolkit/core/pytorch/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKW
213
213
  model_compression_toolkit/core/pytorch/constants.py,sha256=YwD_joIF0vK8UG2vW1NVvg36pCNWA0vHOXjAgy_XWn0,2794
214
214
  model_compression_toolkit/core/pytorch/default_framework_info.py,sha256=r1XyzUFvrjGcJHQM5ETLsMZIG2yHCr9HMjqf0ti9inw,4175
215
215
  model_compression_toolkit/core/pytorch/pytorch_device_config.py,sha256=S25cuw10AW3SEN_fRAGRcG_I3wdvvQx1ehSJzPnn-UI,4404
216
- model_compression_toolkit/core/pytorch/pytorch_implementation.py,sha256=XL_RZcfnb_ZY2jdCjOxxz7SbRBzMokbOWsTuYOSjyRU,27569
216
+ model_compression_toolkit/core/pytorch/pytorch_implementation.py,sha256=xmcJyU-rkIDX1a_X9LILzf2Ko2z_4I4xnlHkezKH-2w,27669
217
217
  model_compression_toolkit/core/pytorch/pytorch_node_prior_info.py,sha256=2LDQ7qupglHQ7o1Am7LWdfYVacfQnl-aW2N6l9det1w,3264
218
218
  model_compression_toolkit/core/pytorch/resource_utilization_data_facade.py,sha256=E6ifk1HdO60k4IRH2EFBzAYWtwUlrGqJoQ66nknpHoQ,4983
219
219
  model_compression_toolkit/core/pytorch/utils.py,sha256=GE7T8q93I5C4As0iOias_dk9HpOvXM1N6---dJlyD60,3863
220
220
  model_compression_toolkit/core/pytorch/back2framework/__init__.py,sha256=H_WixgN0elVWf3exgGYsi58imPoYDj5eYPeh6x4yfug,813
221
- model_compression_toolkit/core/pytorch/back2framework/factory_model_builder.py,sha256=DwNO8WO3JiMawKGKDhlrwCoCjMSBIw5BMbsFFF7eDS4,2279
221
+ model_compression_toolkit/core/pytorch/back2framework/factory_model_builder.py,sha256=bwppTPRs6gL96nm7qPiKrNcBj4Krr0yEsOWjRF0aXmQ,2339
222
222
  model_compression_toolkit/core/pytorch/back2framework/float_model_builder.py,sha256=tLrlUyYhxVKVjkad1ZAtbRra0HedB3iVfIkZ_dYnQ-4,3419
223
223
  model_compression_toolkit/core/pytorch/back2framework/instance_builder.py,sha256=BBHBfTqeWm7L3iDyPBpk0jxvj-rBg1QWI23imkjfIl0,1467
224
224
  model_compression_toolkit/core/pytorch/back2framework/mixed_precision_model_builder.py,sha256=D7lU1r9Uq_7fdNuKk2BMF8ho5GrsY-8gyGN6yYoHaVg,15060
@@ -262,7 +262,7 @@ model_compression_toolkit/core/pytorch/quantizer/fake_quant_builder.py,sha256=D8
262
262
  model_compression_toolkit/core/pytorch/quantizer/lut_fake_quant.py,sha256=uyeBtNokyDUikk-YkDP_mN_2DX0J5oPm3kSfdSUT2Ck,4420
263
263
  model_compression_toolkit/core/pytorch/reader/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
264
264
  model_compression_toolkit/core/pytorch/reader/graph_builders.py,sha256=ESL8k7RLZogTyG_oTTFDmm4RauZvx2gU-UvnOnEsH6Q,15948
265
- model_compression_toolkit/core/pytorch/reader/node_holders.py,sha256=TaolORuwBZEddWe-q0Mg79Nmswz-Sq3-9-4o8UxFQ50,1028
265
+ model_compression_toolkit/core/pytorch/reader/node_holders.py,sha256=7XNc7-l1MZPJGcOESvtAwfIMxrU6kvt3YjF5B7qOqK4,1048
266
266
  model_compression_toolkit/core/pytorch/reader/reader.py,sha256=GEJE0QX8XJFWbYCkbRBtzttZtmmuoACLx8gw9KyAQCE,6015
267
267
  model_compression_toolkit/core/pytorch/statistics_correction/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
268
268
  model_compression_toolkit/core/pytorch/statistics_correction/apply_second_moment_correction.py,sha256=VgU24J3jf7QComHH7jonOXSkg6mO4TOch3uFkOthZvM,3261
@@ -326,7 +326,7 @@ model_compression_toolkit/exporter/model_wrapper/__init__.py,sha256=7CF2zvpTrIEm
326
326
  model_compression_toolkit/exporter/model_wrapper/fw_agnostic/__init__.py,sha256=pKAdbTCFM_2BrZXUtTIw0ouKotrWwUDF_hP3rPwCM2k,696
327
327
  model_compression_toolkit/exporter/model_wrapper/fw_agnostic/get_inferable_quantizers.py,sha256=Bd3QhAR__YC9Xmobd5qHv9ofh_rPn_eTFV0sXizcBnY,2297
328
328
  model_compression_toolkit/exporter/model_wrapper/keras/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
329
- model_compression_toolkit/exporter/model_wrapper/keras/validate_layer.py,sha256=YffgbVYJG5LKeIsW84Pi7NqzQcvJMeQRnAKQCCmIL6c,3776
329
+ model_compression_toolkit/exporter/model_wrapper/keras/validate_layer.py,sha256=llQJ8yY4buSMNue_UnEhGhT5lHpXU7iMqWwCrUt6L08,3816
330
330
  model_compression_toolkit/exporter/model_wrapper/keras/builder/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
331
331
  model_compression_toolkit/exporter/model_wrapper/keras/builder/fully_quantized_model_builder.py,sha256=T2wgd7b86cpA5Ffq5eVCb8YlmnJ7vDxtmFeRkZtpLZc,5422
332
332
  model_compression_toolkit/exporter/model_wrapper/keras/builder/node_to_quantizer.py,sha256=uL6tJWC4s2IWUy8GJVwtMWpwZZioRRztfKyPJHo14xI,9442
@@ -342,7 +342,7 @@ model_compression_toolkit/gptq/common/gptq_config.py,sha256=U-NiVEedkOsVaFq-iXU2
342
342
  model_compression_toolkit/gptq/common/gptq_constants.py,sha256=QSm6laLkIV0LYmU0BLtmKp3Fi3SqDfbncFQWOGA1cGU,611
343
343
  model_compression_toolkit/gptq/common/gptq_framework_implementation.py,sha256=n3mSf4J92kFjekzyGyrJULylI-8Jf5OVWJ5AFoVnEx0,1266
344
344
  model_compression_toolkit/gptq/common/gptq_graph.py,sha256=-bL5HhPcKqV8nj4dZPXc5QmQJbFBel6etrioikP0tEo,3039
345
- model_compression_toolkit/gptq/common/gptq_training.py,sha256=nI_XVa7WbfCcbgHMFgnPtnD77m5ezAB306z7VE0XFvU,16527
345
+ model_compression_toolkit/gptq/common/gptq_training.py,sha256=CtSpjG27BQ3rLPGWeBnZYYiGnMREpdBd6dx7SQf_wDk,14965
346
346
  model_compression_toolkit/gptq/keras/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
347
347
  model_compression_toolkit/gptq/keras/gptq_keras_implementation.py,sha256=axBwnCSjq5xk-xGymOwSOqjp39It-CVtGcCTRTf0E_4,1248
348
348
  model_compression_toolkit/gptq/keras/gptq_loss.py,sha256=rbRkF15MYd6nq4G49kcjb_dPTa-XNq9cTkrb93mXawo,6241
@@ -394,7 +394,7 @@ model_compression_toolkit/qat/common/qat_config.py,sha256=zoq0Vb74vCY7WlWD8JH_KP
394
394
  model_compression_toolkit/qat/keras/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
395
395
  model_compression_toolkit/qat/keras/quantization_facade.py,sha256=AXwY6p1XFjPUzal_r_c1_su5Ji3ARtVTZYYWpDPZ09k,17026
396
396
  model_compression_toolkit/qat/keras/quantizer/__init__.py,sha256=zmYyCa25_KLCSUCGUDRslh3RCIjcRMxc_oXa54Aui-4,996
397
- model_compression_toolkit/qat/keras/quantizer/base_keras_qat_quantizer.py,sha256=TIFdLEeUUTH-ZKoqfbqmL8rq2iuFCwb8CZ61rIJDOIM,2065
397
+ model_compression_toolkit/qat/keras/quantizer/base_keras_qat_quantizer.py,sha256=0CB5M68zjPXv4yJZ-DzaYP9yYYWX_8J2gJLunxupOAM,2085
398
398
  model_compression_toolkit/qat/keras/quantizer/quant_utils.py,sha256=cBULOgWUodcBO1lHevZggdTevuDYI6tQceV86U2x6DA,2543
399
399
  model_compression_toolkit/qat/keras/quantizer/quantization_builder.py,sha256=HD0JIOiqnrpqj5qk6RyzuCsSGZsDUVohdCYSePmJBNQ,5872
400
400
  model_compression_toolkit/qat/keras/quantizer/lsq/__init__.py,sha256=lNJ29DYxaLUPDstRDA1PGI5r9Fulq_hvrZMlhst1Z5g,697
@@ -406,7 +406,7 @@ model_compression_toolkit/qat/keras/quantizer/ste_rounding/uniform_ste.py,sha256
406
406
  model_compression_toolkit/qat/pytorch/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
407
407
  model_compression_toolkit/qat/pytorch/quantization_facade.py,sha256=pRy2B5OsaLi33p4hozjr0rzAooT8Gic3_qxTl66J900,13375
408
408
  model_compression_toolkit/qat/pytorch/quantizer/__init__.py,sha256=xYa4C8pr9cG1f3mQQcBXO_u3IdJN-zl7leZxuXDs86w,1003
409
- model_compression_toolkit/qat/pytorch/quantizer/base_pytorch_qat_quantizer.py,sha256=soxP4moJxQaziq5ccP3Du34fSIVSFyZq6hD8YuaDn88,2187
409
+ model_compression_toolkit/qat/pytorch/quantizer/base_pytorch_qat_quantizer.py,sha256=2I_WcINn63lpT3mN_skXNL4Rfbm955_wzhYHaiwH2q4,2207
410
410
  model_compression_toolkit/qat/pytorch/quantizer/quantization_builder.py,sha256=sFWGu76PZ9dSRf3L0uZI6YwLIs0biBND1tl76I1piBQ,5721
411
411
  model_compression_toolkit/qat/pytorch/quantizer/quantizer_utils.py,sha256=nO7IrDRo5b9Asf21WJacE4vf5voD3UzF_oGjBoGusD4,5335
412
412
  model_compression_toolkit/qat/pytorch/quantizer/lsq/__init__.py,sha256=huHoBUcKNB6BnY6YaUCcFvdyBtBI172ZoUD8ZYeNc6o,696
@@ -421,9 +421,9 @@ model_compression_toolkit/target_platform_capabilities/immutable.py,sha256=YhROB
421
421
  model_compression_toolkit/target_platform_capabilities/target_platform/__init__.py,sha256=bD2xE101rRw7pGarGiBzYraeFF7FUnzyWtAVzwu5JT4,1724
422
422
  model_compression_toolkit/target_platform_capabilities/target_platform/current_tp_model.py,sha256=1Glr4qKDJfdk5TwM5fzZ12XzgbpQFioDOxb475905gk,2013
423
423
  model_compression_toolkit/target_platform_capabilities/target_platform/fusing.py,sha256=f3xBAI6ivPvEj4lw8cAvTKdIbs7CRdLAa_0LvhGw3Dg,3924
424
- model_compression_toolkit/target_platform_capabilities/target_platform/op_quantization_config.py,sha256=tpy19ZwFCqPWCFtTc76K_kv2dEzFqojdsnWhYxjdDUA,15015
424
+ model_compression_toolkit/target_platform_capabilities/target_platform/op_quantization_config.py,sha256=AJfW-uGrXZToaPa8BiyuBv38T7yV_RRrGIHr4Ji946I,15178
425
425
  model_compression_toolkit/target_platform_capabilities/target_platform/operators.py,sha256=rRmrmPBY4rxCWVpEc6FxeOPUFh8MkfwgQsqD82U9a7w,3108
426
- model_compression_toolkit/target_platform_capabilities/target_platform/target_platform_model.py,sha256=55EQyP4McJBwsw9_l9eseEZ-V2ygQfdRXjjJLF6HdIM,9482
426
+ model_compression_toolkit/target_platform_capabilities/target_platform/target_platform_model.py,sha256=mU4djXodftvTqJnFH6-9ISuY1uECjj1xi6SijJWpiRg,9477
427
427
  model_compression_toolkit/target_platform_capabilities/target_platform/target_platform_model_component.py,sha256=TDbNQwmF7Id-FoIQZlR7ZOcz_nRb4XKBmDihAgKT0u8,1392
428
428
  model_compression_toolkit/target_platform_capabilities/target_platform/targetplatform2framework/__init__.py,sha256=WCP1wfFZgM4eFm-pPeUinr5R_aSx5qwfSQqLZCXUNBA,1513
429
429
  model_compression_toolkit/target_platform_capabilities/target_platform/targetplatform2framework/attribute_filter.py,sha256=jfhszvuD2Fyy6W2KjlLzXBQKFzTqGAaDZeFVr4-ONQw,8776
@@ -521,8 +521,8 @@ model_compression_toolkit/xquant/pytorch/model_analyzer.py,sha256=b93o800yVB3Z-i
521
521
  model_compression_toolkit/xquant/pytorch/pytorch_report_utils.py,sha256=yrZNVRm2IRU7r7R-hjS2lOQ6wvEEvbeunvf2jKoWjXk,3277
522
522
  model_compression_toolkit/xquant/pytorch/similarity_functions.py,sha256=CERxq5K8rqaiE-DlwhZBTUd9x69dtYJlkHOPLB54vm8,2354
523
523
  model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=eyMoXt5o5EnMr6d-rpCwQdX5mAiYiymvbgKv4tf7-a0,4576
524
- mct_nightly-2.1.0.20240730.436.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
525
- mct_nightly-2.1.0.20240730.436.dist-info/METADATA,sha256=A8w_lgs16pLb6T44oV5i9FLLn3UDt0dn5wS3jB0B6sI,19719
526
- mct_nightly-2.1.0.20240730.436.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
527
- mct_nightly-2.1.0.20240730.436.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
528
- mct_nightly-2.1.0.20240730.436.dist-info/RECORD,,
524
+ mct_nightly-2.1.0.20240801.515.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
525
+ mct_nightly-2.1.0.20240801.515.dist-info/METADATA,sha256=pry-813t-qxDBgTyO7RCAsGWfQbNwdOMVUs5r7Hdf_s,19719
526
+ mct_nightly-2.1.0.20240801.515.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
527
+ mct_nightly-2.1.0.20240801.515.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
528
+ mct_nightly-2.1.0.20240801.515.dist-info/RECORD,,
@@ -27,4 +27,4 @@ from model_compression_toolkit import data_generation
27
27
  from model_compression_toolkit import pruning
28
28
  from model_compression_toolkit.trainable_infrastructure.keras.load_model import keras_load_quantized_model
29
29
 
30
- __version__ = "2.1.0.20240730.000436"
30
+ __version__ = "2.1.0.20240801.000515"
@@ -348,24 +348,20 @@ class FrameworkImplementation(ABC):
348
348
  raise NotImplemented(f'{self.__class__.__name__} have to implement the '
349
349
  f'framework\'s count_node_for_mixed_precision_interest_points method.') # pragma: no cover
350
350
 
351
- def get_mp_node_distance_fn(self, layer_class: type,
352
- framework_attrs: Dict[str, Any],
353
- compute_distance_fn: Callable = None,
354
- axis: int = None,
355
- norm_mse: bool = False) -> Callable:
351
+ def get_mp_node_distance_fn(self, n: BaseNode,
352
+ compute_distance_fn: Callable = None,
353
+ norm_mse: bool = False) -> Tuple[Callable, int]:
356
354
  """
357
355
  A mapping between layers' types and a distance function for computing the distance between
358
356
  two tensors in mixed precision (for loss computation purposes). Returns a specific function if node of specific types is
359
357
  given, or a default (normalized MSE) function otherwise.
360
358
 
361
359
  Args:
362
- layer_class: Class path of a model's layer.
363
- framework_attrs: Framework attributes the layer had which the graph node holds.
360
+ n: Node to choose distance function for.
364
361
  compute_distance_fn: An optional distance function to use globally for all nodes.
365
- axis: The axis on which the operation is preformed (if specified).
366
362
  norm_mse: whether to normalize mse distance function.
367
363
 
368
- Returns: A distance function between two tensors.
364
+ Returns: A distance function between two tensors and a axis on which the distance is computed (if exists).
369
365
  """
370
366
 
371
367
  raise NotImplemented(f'{self.__class__.__name__} have to implement the '
@@ -440,7 +440,7 @@ class Graph(nx.MultiDiGraph, GraphSearches):
440
440
 
441
441
  output_nodes = [ot.node for ot in self.get_outputs()] # get output nodes from namedtuples
442
442
  if node_to_remove in output_nodes: # If node is in the graph's outputs, the outputs should be updated
443
- if new_graph_outputs is None:
443
+ if new_graph_outputs is None: # pragma: no cover
444
444
  Logger.critical(
445
445
  f"{node_to_remove.name} is among the graph outputs; however, it cannot be removed without providing a new output.") # pragma: no cover
446
446
  self.set_outputs(new_graph_outputs)
@@ -506,28 +506,6 @@ class Graph(nx.MultiDiGraph, GraphSearches):
506
506
  output_edges.sort(key=lambda e: getattr(e, sort_by_attr))
507
507
  return output_edges
508
508
 
509
- def get_memory(self) -> float:
510
- """
511
-
512
- Returns: Total memory consumption of the graph in bytes.
513
-
514
- """
515
- memory = 0
516
- for n in self.nodes:
517
- memory += n.get_memory_bytes(self.fw_info)
518
- return memory
519
-
520
- def get_float_memory(self) -> float:
521
- """
522
-
523
- Returns: Total memory consumption of the float graph in bytes.
524
-
525
- """
526
- memory = 0
527
- for n in self.nodes:
528
- memory += n.get_float_memory_bytes(self.fw_info)
529
- return memory
530
-
531
509
  def get_configurable_sorted_nodes_names(self,
532
510
  fw_info: FrameworkInfo,
533
511
  include_reused_nodes: bool = False) -> List[str]:
@@ -297,18 +297,6 @@ class BaseNode:
297
297
 
298
298
  return memory
299
299
 
300
- def get_float_memory_bytes(self, fw_info) -> float:
301
- """
302
- Compute the number of bytes the node's memory requires.
303
-
304
- Args:
305
- fw_info: Framework info to decide which attributes should be quantized.
306
-
307
- Returns: Number of bytes the node's memory requires when in floating point (32 bit).
308
-
309
- """
310
- q_params, f_params = self.get_num_parameters(fw_info)
311
- return (f_params + q_params) * FP32_BYTES_PER_PARAMETER
312
300
 
313
301
  def get_unified_weights_candidates_dict(self, fw_info) -> Dict[str, Any]:
314
302
  """
@@ -436,20 +424,6 @@ class BaseNode:
436
424
 
437
425
  return sum([np.prod([x for x in output_shape if x is not None]) for output_shape in output_shapes])
438
426
 
439
- def get_total_input_params(self) -> float:
440
- """
441
- Calculates the total parameters in the node's input tensors.
442
-
443
- Returns: Input size (i.e., total number of parameters).
444
- """
445
-
446
- input_shapes = self.input_shape if isinstance(self.input_shape, List) else [self.input_shape]
447
-
448
- # remove batch size (first element) from input shape
449
- input_shapes = [s[1:] for s in input_shapes]
450
-
451
- return sum([np.prod([x for x in input_shape if x is not None]) for input_shape in input_shapes])
452
-
453
427
  def find_min_candidates_indices(self) -> List[int]:
454
428
  """
455
429
  Returns a list with potential minimal candidates.
@@ -644,10 +618,10 @@ class BaseNode:
644
618
  if len(simd_list) > 1:
645
619
  Logger.warning(f"More than one pruning SIMD option is available."
646
620
  f" Min SIMD is used: {min(simd_list)}")
647
- if len(simd_list) == 0:
621
+ if len(simd_list) == 0: # pragma: no cover
648
622
  Logger.critical(f"No SIMD option is available for {self}")
649
623
  _simd = min(simd_list)
650
- if _simd <= 0 or int(_simd) != _simd:
624
+ if _simd <= 0 or int(_simd) != _simd: # pragma: no cover
651
625
  Logger.critical(f"SIMD is expected to be a non-positive integer but found: {_simd}")
652
626
  return _simd
653
627
 
@@ -77,7 +77,8 @@ class SensitivityEvaluation:
77
77
  self.disable_activation_for_metric = disable_activation_for_metric
78
78
  if self.quant_config.use_hessian_based_scores:
79
79
  if not isinstance(hessian_info_service, HessianInfoService):
80
- Logger.critical(f"When using Hessian-based approximations for sensitivity evaluation, a valid HessianInfoService object is required; found {type(hessian_info_service)}.")
80
+ Logger.critical(
81
+ f"When using Hessian-based approximations for sensitivity evaluation, a valid HessianInfoService object is required; found {type(hessian_info_service)}.")
81
82
  self.hessian_info_service = hessian_info_service
82
83
 
83
84
  self.sorted_configurable_nodes_names = graph.get_configurable_sorted_nodes_names(self.fw_info)
@@ -94,7 +95,8 @@ class SensitivityEvaluation:
94
95
  self.ips_distance_fns, self.ips_axis = self._init_metric_points_lists(self.interest_points, use_normalized_mse)
95
96
 
96
97
  self.output_points = get_output_nodes_for_metric(graph)
97
- self.out_ps_distance_fns, self.out_ps_axis = self._init_metric_points_lists(self.output_points, use_normalized_mse)
98
+ self.out_ps_distance_fns, self.out_ps_axis = self._init_metric_points_lists(self.output_points,
99
+ use_normalized_mse)
98
100
 
99
101
  # Setting lists with relative position of the interest points
100
102
  # and output points in the list of all mp model activation tensors
@@ -130,7 +132,8 @@ class SensitivityEvaluation:
130
132
  self.interest_points_hessians = self._compute_hessian_based_scores()
131
133
  self.quant_config.distance_weighting_method = lambda d: self.interest_points_hessians
132
134
 
133
- def _init_metric_points_lists(self, points: List[BaseNode], norm_mse: bool = False) -> Tuple[List[Callable], List[int]]:
135
+ def _init_metric_points_lists(self, points: List[BaseNode], norm_mse: bool = False) -> Tuple[
136
+ List[Callable], List[int]]:
134
137
  """
135
138
  Initiates required lists for future use when computing the sensitivity metric.
136
139
  Each point on which the metric is computed uses a dedicated distance function based on its type.
@@ -146,16 +149,12 @@ class SensitivityEvaluation:
146
149
  distance_fns_list = []
147
150
  axis_list = []
148
151
  for n in points:
149
- axis = n.framework_attr.get(AXIS) if not isinstance(n, FunctionalNode) else n.op_call_kwargs.get(AXIS)
150
- distance_fn = self.fw_impl.get_mp_node_distance_fn(
151
- layer_class=n.layer_class,
152
- framework_attrs=n.framework_attr,
153
- compute_distance_fn=self.quant_config.compute_distance_fn,
154
- axis=axis,
155
- norm_mse=norm_mse)
152
+ distance_fn, axis = self.fw_impl.get_mp_node_distance_fn(n,
153
+ compute_distance_fn=self.quant_config.compute_distance_fn,
154
+ norm_mse=norm_mse)
156
155
  distance_fns_list.append(distance_fn)
157
156
  # Axis is needed only for KL Divergence calculation, otherwise we use per-tensor computation
158
- axis_list.append(axis if distance_fn==compute_kl_divergence else None)
157
+ axis_list.append(axis if distance_fn == compute_kl_divergence else None)
159
158
  return distance_fns_list, axis_list
160
159
 
161
160
  def compute_metric(self,
@@ -300,7 +299,8 @@ class SensitivityEvaluation:
300
299
  node_name = sorted_configurable_nodes_names[node_idx_to_configure]
301
300
  layers_to_config = self.conf_node2layers.get(node_name, None)
302
301
  if layers_to_config is None:
303
- Logger.critical(f"Matching layers for node {node_name} not found in the mixed precision model configuration.") # pragma: no cover
302
+ Logger.critical(
303
+ f"Matching layers for node {node_name} not found in the mixed precision model configuration.") # pragma: no cover
304
304
 
305
305
  for current_layer in layers_to_config:
306
306
  self.set_layer_to_bitwidth(current_layer, mp_model_configuration[node_idx_to_configure])
@@ -58,7 +58,7 @@ class CandidateNodeQuantizationConfig(BaseNodeQuantizationConfig):
58
58
  if activation_quantization_cfg is not None:
59
59
  self.activation_quantization_cfg = activation_quantization_cfg
60
60
  else:
61
- if any(v is None for v in (qc, op_cfg, activation_quantization_fn, activation_quantization_params_fn)):
61
+ if any(v is None for v in (qc, op_cfg, activation_quantization_fn, activation_quantization_params_fn)): # pragma: no cover
62
62
  Logger.critical(
63
63
  "Missing required arguments to initialize a node activation quantization configuration. "
64
64
  "Ensure QuantizationConfig, OpQuantizationConfig, activation quantization function, "
@@ -72,7 +72,7 @@ class CandidateNodeQuantizationConfig(BaseNodeQuantizationConfig):
72
72
  if weights_quantization_cfg is not None:
73
73
  self.weights_quantization_cfg = weights_quantization_cfg
74
74
  else:
75
- if any(v is None for v in (qc, op_cfg, node_attrs_list)):
75
+ if any(v is None for v in (qc, op_cfg, node_attrs_list)): # pragma: no cover
76
76
  Logger.critical("Missing required arguments to initialize a node weights quantization configuration. "
77
77
  "Ensure QuantizationConfig, OpQuantizationConfig, weights quantization function, "
78
78
  "parameters function, and weights attribute quantization config are provided.")
@@ -178,20 +178,6 @@ class NodeActivationQuantizationConfig(BaseNodeQuantizationConfig):
178
178
  for param_name, param_value in activation_params.items():
179
179
  self.activation_quantization_params[param_name] = param_value
180
180
 
181
- def has_activation_quantization_params(self) -> bool:
182
- """
183
-
184
- Returns: Whether NodeQuantizationConfig has a activation quantization params or not.
185
-
186
- """
187
- return len(self.activation_quantization_params) > 0
188
-
189
- def no_quantization(self) -> bool:
190
- """
191
- Returns: Whether NodeQuantizationConfig does not have activation params.
192
- """
193
- return (not self.has_activation_quantization_params())
194
-
195
181
  def __eq__(self, other: Any) -> bool:
196
182
  """
197
183
  Compares the object to another object to find if they are equal.
@@ -203,7 +189,7 @@ class NodeActivationQuantizationConfig(BaseNodeQuantizationConfig):
203
189
 
204
190
  """
205
191
  if not isinstance(other, NodeActivationQuantizationConfig):
206
- return False
192
+ return False # pragma: no cover
207
193
 
208
194
  return self.activation_quantization_fn == other.activation_quantization_fn and \
209
195
  self.activation_quantization_params_fn == other.activation_quantization_params_fn and \
@@ -340,14 +326,6 @@ class WeightsAttrQuantizationConfig:
340
326
  else:
341
327
  self.set_weights_quantization_param({})
342
328
 
343
- def has_weights_quantization_params(self) -> bool:
344
- """
345
-
346
- Returns: Whether NodeQuantizationConfig has weights quantization params or not.
347
-
348
- """
349
- return len(self.weights_quantization_params) > 0
350
-
351
329
  def __eq__(self, other: Any) -> bool:
352
330
  """
353
331
  Compares the object to another object to find if they are equal.
@@ -359,7 +337,7 @@ class WeightsAttrQuantizationConfig:
359
337
 
360
338
  """
361
339
  if not isinstance(other, WeightsAttrQuantizationConfig):
362
- return False
340
+ return False # pragma: no cover
363
341
 
364
342
  return self.weights_quantization_fn == other.weights_quantization_fn and \
365
343
  self.weights_quantization_params_fn == other.weights_quantization_params_fn and \
@@ -419,11 +397,11 @@ class NodeWeightsQuantizationConfig(BaseNodeQuantizationConfig):
419
397
  # In Tensorflow, the attribute name is composed of the framework attribute name and the layer name,
420
398
  # therefore, we need to look for the attribute in the op_cfg that is contained in the node attribute's name.
421
399
  attrs_included_in_name = {k: v for k, v in op_cfg.attr_weights_configs_mapping.items() if k in attr}
422
- if len(attrs_included_in_name) > 1:
423
- Logger.error(f"Found multiple attribute in TPC OpConfig that are contained "
424
- f"in the attribute name '{attr}'."
425
- f"Please fix the TPC attribute names mapping such that each operator's attribute would "
426
- f"have a unique matching name.")
400
+ if len(attrs_included_in_name) > 1: # pragma: no cover
401
+ Logger.critical(f"Found multiple attribute in TPC OpConfig that are contained "
402
+ f"in the attribute name '{attr}'."
403
+ f"Please fix the TPC attribute names mapping such that each operator's attribute would "
404
+ f"have a unique matching name.")
427
405
  if len(attrs_included_in_name) == 0:
428
406
  attr_cfg = op_cfg.default_weight_attr_config
429
407
  else:
@@ -446,8 +424,8 @@ class NodeWeightsQuantizationConfig(BaseNodeQuantizationConfig):
446
424
  Returns: An attribute quantization configuration.
447
425
 
448
426
  """
449
- if attr_name is None:
450
- Logger.error("Got 'None' attribute name for retrieving weights attribute quantization configuration.")
427
+ if attr_name is None: # pragma: no cover
428
+ Logger.critical("Got 'None' attribute name for retrieving weights attribute quantization configuration.")
451
429
 
452
430
  if isinstance(attr_name, int):
453
431
  # this is a positional attribute
@@ -463,8 +441,8 @@ class NodeWeightsQuantizationConfig(BaseNodeQuantizationConfig):
463
441
  # If no attribute with the exact name then an error would be thrown
464
442
  attr_cfg = self.attributes_config_mapping.get(attr_name)
465
443
 
466
- if attr_cfg is None:
467
- Logger.error(f"Weight attribute '{attr_name}' config could not be found.")
444
+ if attr_cfg is None: # pragma: no cover
445
+ Logger.critical(f"Weight attribute '{attr_name}' config could not be found.")
468
446
 
469
447
  return attr_cfg
470
448
 
@@ -519,8 +497,8 @@ class NodeWeightsQuantizationConfig(BaseNodeQuantizationConfig):
519
497
  f"{list(attrs_with_name.keys())}.")
520
498
  return attrs_with_name
521
499
 
522
- def set_quant_config_attr(self, config_parameter_name: str, config_parameter_value: Any, attr_name: str = None,
523
- *args: List[Any], **kwargs: Dict[str, Any]):
500
+ def set_quant_config_attr(self, config_parameter_name: str, config_parameter_value: Any,
501
+ attr_name: Union[str, int] = None, *args: List[Any], **kwargs: Dict[str, Any]):
524
502
  """
525
503
  This method overrides the parent class set_quant_config_attr to enable setting a specific weights
526
504
  attribute config parameter.
@@ -546,8 +524,8 @@ class NodeWeightsQuantizationConfig(BaseNodeQuantizationConfig):
546
524
  else:
547
525
  Logger.warning(f"Parameter {config_parameter_name} could not be found in the node quantization config of "
548
526
  f"weights attribute {attr_name} and was not updated!")
549
- else:
550
- Logger.error(f"Weights attribute {attr_name} could not be found to set parameter {config_parameter_name}.")
527
+ else: # pragma: no cover
528
+ Logger.critical(f"Weights attribute {attr_name} could not be found to set parameter {config_parameter_name}.")
551
529
 
552
530
  def __eq__(self, other: Any) -> bool:
553
531
  """
@@ -560,7 +538,7 @@ class NodeWeightsQuantizationConfig(BaseNodeQuantizationConfig):
560
538
 
561
539
  """
562
540
  if not isinstance(other, NodeWeightsQuantizationConfig):
563
- return False
541
+ return False # pragma: no cover
564
542
 
565
543
  return self.min_threshold == other.min_threshold and \
566
544
  self.simd_size == other.simd_size and \
@@ -22,10 +22,7 @@ from model_compression_toolkit.defaultdict import DefaultDict
22
22
  from model_compression_toolkit.core.common.framework_info import FrameworkInfo
23
23
  from model_compression_toolkit.core.common.quantization.node_quantization_config import NodeWeightsQuantizationConfig, \
24
24
  WeightsAttrQuantizationConfig
25
-
26
- # If the quantization config does not contain kernel channel mapping or the weights
27
- # quantization is not per-channel, we use a dummy channel mapping.
28
- dummy_channel_mapping = DefaultDict(default_value=(None, None))
25
+ from model_compression_toolkit.logger import Logger
29
26
 
30
27
 
31
28
  def get_weights_qparams(weights_attr_values: np.ndarray,
@@ -64,29 +61,10 @@ def get_weights_qparams(weights_attr_values: np.ndarray,
64
61
  node=node,
65
62
  hessian_info_service=hessian_info_service,
66
63
  num_hessian_samples=num_hessian_samples)
67
- else:
64
+ else: # pragma: no cover
65
+ Logger.error(f"Requested weights quantization parameters computation for node {node.name} without providing a "
66
+ f"weights_quantization_params_fn."
67
+ f"Returning an empty dictionary since no quantization parameters were computed.")
68
68
  weights_params = {}
69
69
 
70
70
  return weights_params, output_channels_axis
71
-
72
-
73
- def _get_kernel_channels_mapping(fw_info:FrameworkInfo,
74
- use_dummy: bool) -> DefaultDict:
75
- """
76
- Get a kernel channel mapping from the framework info, or use dummy mapping (which returns a
77
- tuple of Nones) if use_use_dummy is True.
78
-
79
- Args:
80
- fw_info: Framework info which contains a kernel channels mapping.
81
- use_dummy: Whether to use a dummy mapping or not.
82
-
83
- Returns:
84
- Kernel channels mapping.
85
- """
86
-
87
- # Set a kernel channels mapping
88
- if use_dummy: # If kernel mapping is missing, we use a dummy channels mapping
89
- kernel_channels_mapping = dummy_channel_mapping
90
- else:
91
- kernel_channels_mapping = fw_info.kernel_channels_mapping
92
- return kernel_channels_mapping
@@ -60,33 +60,6 @@ def calculate_delta(threshold: np.ndarray,
60
60
  return threshold / (2 ** (n_bits - int(signed)))
61
61
 
62
62
 
63
- def calculate_min_max_values(threshold: np.ndarray,
64
- n_bits: int = 8,
65
- signed: bool = False) -> Tuple[np.ndarray, np.ndarray]:
66
- """
67
- Compute the min/max values of a quantization range according to the threshold,
68
- number of bits and whether its signed or unsigned.
69
-
70
- Args:
71
- threshold: Threshold of quantization range to compute its min/max values.
72
- n_bits: Number of bits used in the quantization.
73
- signed: Whether the quantization range is signed or not.
74
-
75
- Returns:
76
- Min/max values of quantization range.
77
- """
78
-
79
- delta = calculate_delta(threshold,
80
- n_bits=n_bits,
81
- signed=signed)
82
-
83
- # If unsigned: min=0, otherwise its -threshold
84
- min_value = int(signed) * -threshold
85
- max_value = threshold - delta
86
-
87
- return min_value, max_value
88
-
89
-
90
63
  def quantize_tensor(tensor_data: np.ndarray,
91
64
  threshold: np.ndarray,
92
65
  n_bits: int,
@@ -238,7 +211,7 @@ def get_tensor_max(tensor_data: np.ndarray,
238
211
 
239
212
  """
240
213
  if n_bits < 1:
241
- Logger.critical(f"Parameter n_bits must be positive; however 'n_bits'={n_bits} was provided.")
214
+ Logger.critical(f"Parameter n_bits must be positive; however 'n_bits'={n_bits} was provided.") # pragma: no cover
242
215
  if is_uniform_quantization:
243
216
  expansion_factor = 1.0
244
217
  elif n_bits == 1:
@@ -337,40 +310,3 @@ def get_output_shape(tensor_shape, channel_axis):
337
310
 
338
311
  """
339
312
  return [-1 if i is channel_axis else 1 for i in range(len(tensor_shape))]
340
-
341
-
342
- def get_range_bounds(tensor_min, tensor_max):
343
- """
344
- Gets bounds on the quantization range limits for the minimization process.
345
- Calculates the bounds in a way that would leave a gap between the possible optimized values
346
- and the tensor min-max values.
347
-
348
- Args:
349
- tensor_min: min value of a tensor.
350
- tensor_max: max value of a tensor.
351
-
352
- Returns: An array with (lbound, ubound) pairs on the quantization range limit values.
353
-
354
- """
355
- # choosing bounds that have some gap from the original tensor min/max values.
356
- l_bound = tensor_min / 2 if tensor_min > 0 else tensor_min * 2
357
- u_bound = tensor_max * 2 if tensor_max > 0 else tensor_min / 2
358
- return [(l_bound, u_bound), (l_bound, u_bound)]
359
-
360
-
361
- def get_threshold_bounds(min_threshold, max_threshold):
362
- """
363
- Gets bounds on the threshold for the minimization process.
364
- Calculates the bounds in a way that would leave a gap between the possible optimized threshold
365
- and the tensor max values. We use min_threshold as lower-bound to prevent the selected threshold
366
- from being zero or negative.
367
-
368
- Args:
369
- min_threshold: minimal threshold to use if threshold is too small (not used for this method).
370
- max_threshold: maximal threshold to be used in quantization.
371
-
372
- Returns: An array with a pair of (lbound, ubound) on the quantization threshold limit values.
373
-
374
- """
375
- max_threshold = max(min_threshold, max_threshold)
376
- return [(min_threshold, 2 * max_threshold)]
@@ -37,10 +37,10 @@ def get_keras_model_builder(mode: ModelBuilderMode) -> type:
37
37
  Keras model builder for the given mode.
38
38
  """
39
39
 
40
- if not isinstance(mode, ModelBuilderMode):
40
+ if not isinstance(mode, ModelBuilderMode): # pragma: no cover
41
41
  Logger.critical(f"Expected a ModelBuilderMode type for 'mode', but received {type(mode)} instead.")
42
- if mode is None:
42
+ if mode is None: # pragma: no cover
43
43
  Logger.critical(f"get_keras_model_builder received 'mode' is None")
44
- if mode not in keras_model_builders.keys():
44
+ if mode not in keras_model_builders.keys(): # pragma: no cover
45
45
  Logger.critical(f"'mode' {mode} is not recognized in the Keras model builders factory.")
46
46
  return keras_model_builders.get(mode)
@@ -21,6 +21,7 @@ from mct_quantizers import KerasQuantizationWrapper, KerasActivationQuantization
21
21
  from tensorflow.keras.models import Model
22
22
 
23
23
  from model_compression_toolkit.constants import HESSIAN_NUM_ITERATIONS
24
+ from model_compression_toolkit.core.common.graph.functional_node import FunctionalNode
24
25
  from model_compression_toolkit.core.common.hessian import HessianScoresRequest, HessianMode, HessianInfoService
25
26
  from model_compression_toolkit.core.keras.graph_substitutions.substitutions.remove_identity import RemoveIdentity
26
27
  from model_compression_toolkit.core.keras.hessian.activation_hessian_scores_calculator_keras import \
@@ -421,44 +422,47 @@ class KerasImplementation(FrameworkImplementation):
421
422
 
422
423
  return False
423
424
 
424
- def get_mp_node_distance_fn(self, layer_class: type,
425
- framework_attrs: Dict[str, Any],
426
- compute_distance_fn: Callable = None,
427
- axis: int = None,
428
- norm_mse: bool = False) -> Callable:
425
+ def get_mp_node_distance_fn(self, n: BaseNode,
426
+ compute_distance_fn: Callable = None,
427
+ norm_mse: bool = False) -> Tuple[Callable, int]:
429
428
  """
430
429
  A mapping between layers' types and a distance function for computing the distance between
431
430
  two tensors in mixed precision (for loss computation purposes). Returns a specific function if node of specific types is
432
431
  given, or a default (normalized MSE) function otherwise.
433
432
 
434
433
  Args:
435
- layer_class: Class path of a model's layer.
436
- framework_attrs: Framework attributes the layer had which the graph node holds.
434
+ n: Node to choose distance function for.
437
435
  compute_distance_fn: An optional distance function to use globally for all nodes.
438
- axis: The axis on which the operation is preformed (if specified).
439
436
  norm_mse: whether to normalize mse distance function.
440
437
 
441
- Returns: A distance function between two tensors.
438
+ Returns: A distance function between two tensors and a axis on which the distance is computed (if exists).
442
439
  """
443
440
 
441
+ axis = n.framework_attr.get(keras_constants.AXIS) \
442
+ if not isinstance(n, FunctionalNode) else n.op_call_kwargs.get(keras_constants.AXIS)
443
+
444
+ layer_class = n.layer_class
445
+ framework_attrs = n.framework_attr
446
+
444
447
  if compute_distance_fn is not None:
445
- return compute_distance_fn
448
+ return compute_distance_fn, axis
446
449
 
447
450
  if layer_class == Activation:
448
451
  node_type_name = framework_attrs[ACTIVATION]
449
452
  if node_type_name == SOFTMAX and axis is not None:
450
- return compute_kl_divergence
453
+ return compute_kl_divergence, axis
451
454
  elif node_type_name == SIGMOID:
452
- return compute_cs
455
+ return compute_cs, axis
453
456
  elif axis is not None and (layer_class == tf.nn.softmax or layer_class == tf.keras.layers.Softmax
454
457
  or (layer_class == TFOpLambda and
455
458
  SOFTMAX in framework_attrs[keras_constants.FUNCTION])):
456
- return compute_kl_divergence
457
- elif layer_class == tf.nn.sigmoid:
458
- return compute_cs
459
+ return compute_kl_divergence, axis
460
+ elif layer_class == tf.nn.sigmoid or (layer_class == TFOpLambda and
461
+ SIGMOID in framework_attrs[keras_constants.FUNCTION]):
462
+ return compute_cs, axis
459
463
  elif layer_class == Dense:
460
- return compute_cs
461
- return partial(compute_mse, norm=norm_mse)
464
+ return compute_cs, axis
465
+ return partial(compute_mse, norm=norm_mse), axis
462
466
 
463
467
  def get_hessian_scores_calculator(self,
464
468
  graph: Graph,
@@ -36,7 +36,7 @@ def to_tf_tensor(tensor):
36
36
  return (to_tf_tensor(t) for t in tensor)
37
37
  elif isinstance(tensor, np.ndarray):
38
38
  return tf.convert_to_tensor(tensor.astype(np.float32))
39
- else:
39
+ else: # pragma: no cover
40
40
  Logger.critical(f'Unsupported type for conversion to TF tensor: {type(tensor)}.')
41
41
 
42
42
 
@@ -69,5 +69,5 @@ def tf_tensor_to_numpy(tensor: Union[List, Tuple, np.ndarray, tf.Tensor, float],
69
69
  return np.array([np_tensor]) if np.isscalar(np_tensor) else np_tensor
70
70
  elif isinstance(tensor, float):
71
71
  return np.array([tensor])
72
- else:
72
+ else: # pragma: no cover
73
73
  Logger.critical(f'Unsupported type for conversion to Numpy array: {type(tensor)}.')
@@ -37,10 +37,10 @@ def get_pytorch_model_builder(mode: ModelBuilderMode) -> type:
37
37
  PyTorch model builder for the given mode.
38
38
  """
39
39
 
40
- if not isinstance(mode, ModelBuilderMode):
40
+ if not isinstance(mode, ModelBuilderMode): # pragma: no cover
41
41
  Logger.critical(f"Expected a ModelBuilderMode type for 'mode' parameter; received {type(mode)} instead.")
42
- if mode is None:
42
+ if mode is None: # pragma: no cover
43
43
  Logger.critical(f"Received 'mode' parameter is None.")
44
- if mode not in pytorch_model_builders.keys():
44
+ if mode not in pytorch_model_builders.keys(): # pragma: no cover
45
45
  Logger.critical(f"'mode' parameter {mode} is not supported by the PyTorch model builders factory.")
46
46
  return pytorch_model_builders.get(mode)
@@ -30,6 +30,7 @@ from model_compression_toolkit.core import QuantizationConfig, FrameworkInfo, Co
30
30
  from model_compression_toolkit.core import common
31
31
  from model_compression_toolkit.core.common import Graph, BaseNode
32
32
  from model_compression_toolkit.core.common.framework_implementation import FrameworkImplementation
33
+ from model_compression_toolkit.core.common.graph.functional_node import FunctionalNode
33
34
  from model_compression_toolkit.core.common.hessian import HessianScoresRequest, HessianMode, HessianInfoService
34
35
  from model_compression_toolkit.core.common.mixed_precision.sensitivity_evaluation import SensitivityEvaluation
35
36
  from model_compression_toolkit.core.common.mixed_precision.set_layer_to_bitwidth import set_layer_to_bitwidth
@@ -403,36 +404,36 @@ class PytorchImplementation(FrameworkImplementation):
403
404
  return True
404
405
  return False
405
406
 
406
- def get_mp_node_distance_fn(self, layer_class: type,
407
- framework_attrs: Dict[str, Any],
408
- compute_distance_fn: Callable = None,
409
- axis: int = None,
410
- norm_mse: bool = False) -> Callable:
407
+ def get_mp_node_distance_fn(self, n: BaseNode,
408
+ compute_distance_fn: Callable = None,
409
+ norm_mse: bool = False) -> Tuple[Callable, int]:
411
410
  """
412
411
  A mapping between layers' types and a distance function for computing the distance between
413
412
  two tensors in mixed precision (for loss computation purposes). Returns a specific function if node of specific types is
414
413
  given, or a default (normalized MSE) function otherwise.
415
414
 
416
415
  Args:
417
- layer_class: Class path of a model's layer.
418
- framework_attrs: Framework attributes the layer had which the graph node holds.
416
+ n: Node to choose distance function for.
419
417
  compute_distance_fn: An optional distance function to use globally for all nodes.
420
- axis: The axis on which the operation is preformed (if specified).
421
418
  norm_mse: whether to normalize mse distance function.
422
419
 
423
- Returns: A distance function between two tensors.
420
+ Returns: A distance function between two tensors and a axis on which the distance is computed (if exists).
424
421
  """
422
+ axis = n.framework_attr.get(pytorch_constants.DIM) if not (
423
+ isinstance(n, FunctionalNode)) else n.op_call_kwargs.get(pytorch_constants.DIM)
424
+
425
+ layer_class = n.layer_class
425
426
 
426
427
  if compute_distance_fn is not None:
427
- return compute_distance_fn
428
+ return compute_distance_fn, axis
428
429
 
429
430
  elif layer_class in [Softmax, softmax] and axis is not None:
430
- return compute_kl_divergence
431
+ return compute_kl_divergence, axis
431
432
  elif layer_class in [Sigmoid, sigmoid]:
432
- return compute_cs
433
+ return compute_cs, axis
433
434
  elif layer_class == Linear:
434
- return compute_cs
435
- return partial(compute_mse, norm=norm_mse)
435
+ return compute_cs, axis
436
+ return partial(compute_mse, norm=norm_mse), axis
436
437
 
437
438
  def is_output_node_compatible_for_hessian_score_computation(self,
438
439
  node: BaseNode) -> bool:
@@ -25,7 +25,7 @@ class DummyPlaceHolder(torch.nn.Module):
25
25
  """
26
26
 
27
27
  def __name__(self):
28
- return PLACEHOLDER
28
+ return PLACEHOLDER # pragma: no cover
29
29
 
30
30
  def forward(self, x):
31
31
  return x
@@ -222,5 +222,6 @@ def _set_final_resource_utilization(graph: Graph,
222
222
 
223
223
  final_ru = ResourceUtilization()
224
224
  final_ru.set_resource_utilization_by_target(final_ru_dict)
225
+ print(final_ru)
225
226
  graph.user_info.final_resource_utilization = final_ru
226
227
  graph.user_info.mixed_precision_cfg = final_bit_widths_config
@@ -24,7 +24,7 @@ if FOUND_TF:
24
24
  if version.parse(tf.__version__) >= version.parse("2.13"):
25
25
  from keras.src.engine.base_layer import Layer
26
26
  from keras.src.engine.input_layer import InputLayer
27
- else:
27
+ else: # pragma: no cover
28
28
  from keras.engine.base_layer import Layer
29
29
  from keras.engine.input_layer import InputLayer
30
30
 
@@ -57,7 +57,7 @@ if FOUND_TF:
57
57
  f'KerasQuantizationWrapper must have a weights_quantizers but has a '
58
58
  f'{type(layer.weights_quantizers)} object') # pragma: no cover
59
59
 
60
- if len(layer.weights_quantizers) == 0:
60
+ if len(layer.weights_quantizers) == 0: # pragma: no cover
61
61
  Logger.critical(f'KerasQuantizationWrapper must have at least one weight quantizer, but found {len(layer.weights_quantizers)} quantizers. If layer is not quantized it should be a Keras layer.')
62
62
 
63
63
  for _, weights_quantizer in layer.weights_quantizers.items():
@@ -219,41 +219,6 @@ class GPTQTrainer(ABC):
219
219
 
220
220
  return hessian_approx_score_by_image
221
221
 
222
- def _get_approximations_by_interest_point(self, approximations: Dict, image_idx: int) -> List:
223
- """
224
- Retrieves hessian approximations for a specific image index.
225
-
226
- Args:
227
- approximations (Dict): Hessian approximations.
228
- image_idx (int): Image index.
229
-
230
- Returns:
231
- List: Hessian approximations for the given image index.
232
- """
233
- approx_by_interest_point = []
234
- for target_node in self.compare_points:
235
- hessian_approx_scores = approximations[target_node][image_idx]
236
- self._validate_scores_approximation(hessian_approx_scores)
237
- approx_by_interest_point.append(hessian_approx_scores[0])
238
- return approx_by_interest_point
239
-
240
- @staticmethod
241
- def _validate_scores_approximation(hessian_approx_scores: List):
242
- """
243
- Validates the structure and length of the Hessian-approximation scores.
244
-
245
- Args:
246
- hessian_approx_scores: Scores to validate.
247
- """
248
- if not isinstance(hessian_approx_scores, list):
249
- Logger.critical(f"Scores approximation was expected to be a list but is of type: {type(hessian_approx_scores)}.") # pragma: no cover
250
- if len(hessian_approx_scores) != 1:
251
- Logger.critical(f"Scores approximation was expected to have a length of 1 "
252
- f"(for computations with granularity set to 'HessianInfoGranularity.PER_TENSOR') "
253
- f"but has a length of {len(hessian_approx_scores)}."
254
- ) # pragma: no cover
255
-
256
-
257
222
  @abstractmethod
258
223
  def build_gptq_model(self):
259
224
  """
@@ -38,7 +38,7 @@ if FOUND_TF:
38
38
 
39
39
  super().__init__(quantization_config)
40
40
 
41
- else:
41
+ else: # pragma: no cover
42
42
  class BaseKerasQATTrainableQuantizer(BaseKerasTrainableQuantizer):
43
43
  def __init__(self,
44
44
  quantization_config: Union[TrainableQuantizerWeightsConfig, TrainableQuantizerActivationConfig]):
@@ -39,7 +39,7 @@ if FOUND_TORCH:
39
39
  """
40
40
  super().__init__(quantization_config)
41
41
 
42
- else:
42
+ else: # pragma: no cover
43
43
  class BasePytorchQATTrainableQuantizer(BasePytorchTrainableQuantizer):
44
44
  def __init__(self,
45
45
  quantization_config: Union[TrainableQuantizerWeightsConfig, TrainableQuantizerActivationConfig]):
@@ -96,7 +96,7 @@ class AttributeQuantizationConfig:
96
96
  Whether this configuration is equal to another object or not.
97
97
  """
98
98
  if not isinstance(other, AttributeQuantizationConfig):
99
- return False
99
+ return False # pragma: no cover
100
100
  return self.weights_quantization_method == other.weights_quantization_method and \
101
101
  self.weights_n_bits == other.weights_n_bits and \
102
102
  self.weights_per_channel_threshold == other.weights_per_channel_threshold and \
@@ -152,7 +152,7 @@ class OpQuantizationConfig:
152
152
  Returns: Info about the quantization configuration as a dictionary.
153
153
 
154
154
  """
155
- return self.__dict__
155
+ return self.__dict__ # pragma: no cover
156
156
 
157
157
  def clone_and_edit(self, attr_to_edit: Dict[str, Dict[str, Any]] = {}, **kwargs):
158
158
  """
@@ -188,7 +188,7 @@ class OpQuantizationConfig:
188
188
  Whether this configuration is equal to another object or not.
189
189
  """
190
190
  if not isinstance(other, OpQuantizationConfig):
191
- return False
191
+ return False # pragma: no cover
192
192
  return self.default_weight_attr_config == other.default_weight_attr_config and \
193
193
  self.attr_weights_configs_mapping == other.attr_weights_configs_mapping and \
194
194
  self.activation_quantization_method == other.activation_quantization_method and \
@@ -279,12 +279,12 @@ class QuantizationConfigOptions:
279
279
  if attrs is None:
280
280
  attrs_to_update = list(qc.attr_weights_configs_mapping.keys())
281
281
  else:
282
- if not isinstance(attrs, List):
282
+ if not isinstance(attrs, List): # pragma: no cover
283
283
  Logger.critical(f"Expected a list of attributes but received {type(attrs)}.")
284
284
  attrs_to_update = attrs
285
285
 
286
286
  for attr in attrs_to_update:
287
- if qc.attr_weights_configs_mapping.get(attr) is None:
287
+ if qc.attr_weights_configs_mapping.get(attr) is None: # pragma: no cover
288
288
  Logger.critical(f'Editing attributes is only possible for existing attributes in the configuration\'s '
289
289
  f'weights config mapping; {attr} does not exist in {qc}.')
290
290
  self.__edit_quantization_configuration(qc.attr_weights_configs_mapping[attr], kwargs)
@@ -310,6 +310,7 @@ class QuantizationConfigOptions:
310
310
  # If not, add base_config to the list of configurations to update
311
311
  cfgs_to_update = [cfg for cfg in qc_options.quantization_config_list]
312
312
  if not any(qc_options.base_config is cfg for cfg in cfgs_to_update):
313
+ # TODO: add test for this case
313
314
  cfgs_to_update.append(qc_options.base_config)
314
315
 
315
316
  for qc in cfgs_to_update:
@@ -319,7 +320,7 @@ class QuantizationConfigOptions:
319
320
  new_attr_mapping = {}
320
321
  for attr in list(qc.attr_weights_configs_mapping.keys()):
321
322
  new_key = layer_attrs_mapping.get(attr)
322
- if new_key is None:
323
+ if new_key is None: # pragma: no cover
323
324
  Logger.critical(f"Attribute \'{attr}\' does not exist in the provided attribute mapping.")
324
325
 
325
326
  new_attr_mapping[new_key] = qc.attr_weights_configs_mapping.pop(attr)
@@ -96,7 +96,7 @@ class TargetPlatformModel(ImmutableClass):
96
96
  for op_set in self.operator_set:
97
97
  if operators_set_name == op_set.name:
98
98
  return op_set.qc_options
99
- return get_default_quantization_config_options()
99
+ return self.default_qco
100
100
 
101
101
  def get_default_op_quantization_config(self) -> OpQuantizationConfig:
102
102
  """
@@ -158,7 +158,7 @@ class TargetPlatformModel(ImmutableClass):
158
158
  self.fusing_patterns.append(tp_model_component)
159
159
  elif isinstance(tp_model_component, OperatorsSetBase):
160
160
  self.operator_set.append(tp_model_component)
161
- else:
161
+ else: # pragma: no cover
162
162
  Logger.critical(f'Attempted to append an unrecognized TargetPlatformModelComponent of type: {type(tp_model_component)}.')
163
163
 
164
164
  def __enter__(self):