mct-nightly 2.0.0.20240505.435__py3-none-any.whl → 2.0.0.20240507.417__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 (41) hide show
  1. {mct_nightly-2.0.0.20240505.435.dist-info → mct_nightly-2.0.0.20240507.417.dist-info}/METADATA +1 -1
  2. {mct_nightly-2.0.0.20240505.435.dist-info → mct_nightly-2.0.0.20240507.417.dist-info}/RECORD +41 -41
  3. model_compression_toolkit/__init__.py +1 -1
  4. model_compression_toolkit/core/common/graph/base_graph.py +3 -3
  5. model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/resource_utilization_data.py +114 -31
  6. model_compression_toolkit/core/common/pruning/mask/per_channel_mask.py +1 -1
  7. model_compression_toolkit/core/common/pruning/mask/per_simd_group_mask.py +1 -1
  8. model_compression_toolkit/core/common/pruning/pruner.py +1 -1
  9. model_compression_toolkit/core/common/pruning/pruning_info.py +1 -1
  10. model_compression_toolkit/core/common/quantization/node_quantization_config.py +2 -4
  11. model_compression_toolkit/core/common/quantization/quantization_config.py +2 -1
  12. model_compression_toolkit/core/common/quantization/quantization_fn_selection.py +1 -1
  13. model_compression_toolkit/core/common/substitutions/remove_identity.py +4 -1
  14. model_compression_toolkit/core/keras/back2framework/keras_model_builder.py +3 -3
  15. model_compression_toolkit/core/keras/back2framework/mixed_precision_model_builder.py +1 -1
  16. model_compression_toolkit/core/keras/default_framework_info.py +1 -1
  17. model_compression_toolkit/core/keras/graph_substitutions/substitutions/activation_decomposition.py +1 -1
  18. model_compression_toolkit/core/keras/graph_substitutions/substitutions/linear_collapsing.py +1 -1
  19. model_compression_toolkit/core/keras/graph_substitutions/substitutions/residual_collapsing.py +1 -1
  20. model_compression_toolkit/core/keras/graph_substitutions/substitutions/shift_negative_activation.py +1 -1
  21. model_compression_toolkit/core/keras/hessian/trace_hessian_calculator_keras.py +1 -1
  22. model_compression_toolkit/core/keras/keras_implementation.py +4 -6
  23. model_compression_toolkit/core/keras/keras_node_prior_info.py +1 -1
  24. model_compression_toolkit/core/keras/quantizer/fake_quant_builder.py +11 -0
  25. model_compression_toolkit/core/keras/reader/common.py +4 -4
  26. model_compression_toolkit/core/pytorch/back2framework/instance_builder.py +0 -15
  27. model_compression_toolkit/core/pytorch/back2framework/pytorch_model_builder.py +1 -1
  28. model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/linear_collapsing.py +1 -1
  29. model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/residual_collapsing.py +1 -1
  30. model_compression_toolkit/core/pytorch/hessian/trace_hessian_calculator_pytorch.py +1 -1
  31. model_compression_toolkit/core/pytorch/pytorch_device_config.py +5 -2
  32. model_compression_toolkit/core/pytorch/quantizer/fake_quant_builder.py +12 -0
  33. model_compression_toolkit/core/runner.py +12 -1
  34. model_compression_toolkit/data_generation/common/model_info_exctractors.py +10 -11
  35. model_compression_toolkit/data_generation/common/optimization_utils.py +9 -9
  36. model_compression_toolkit/gptq/common/gptq_training.py +3 -38
  37. model_compression_toolkit/trainable_infrastructure/keras/base_keras_quantizer.py +1 -4
  38. model_compression_toolkit/trainable_infrastructure/pytorch/base_pytorch_quantizer.py +1 -3
  39. {mct_nightly-2.0.0.20240505.435.dist-info → mct_nightly-2.0.0.20240507.417.dist-info}/LICENSE.md +0 -0
  40. {mct_nightly-2.0.0.20240505.435.dist-info → mct_nightly-2.0.0.20240507.417.dist-info}/WHEEL +0 -0
  41. {mct_nightly-2.0.0.20240505.435.dist-info → mct_nightly-2.0.0.20240507.417.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.0.0.20240505.435
3
+ Version: 2.0.0.20240507.417
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=Mt46gb-RCiOQ2vyBN_nPmHDTfym0TJcuRuGlaLlj69s,1573
1
+ model_compression_toolkit/__init__.py,sha256=M4OOzsMhIiYGu31hTOTMIoWOhnOqmtXMdBoirTO9vZA,1573
2
2
  model_compression_toolkit/constants.py,sha256=yIJyJ-e1WrDeKD9kG15qkqfYnoj7J1J2CxnJDt008ik,3756
3
3
  model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
4
4
  model_compression_toolkit/logger.py,sha256=3DByV41XHRR3kLTJNbpaMmikL8icd9e1N-nkQAY9oDk,4567
@@ -7,7 +7,7 @@ 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=0ga95vh_ZXO79r8FB26L5GIZKHkG98wq1hMsNH1bIeU,6453
10
- model_compression_toolkit/core/runner.py,sha256=E_gXj95Az3C3swsv7v1zeKZx25keWjnD30uhI7ONZkY,12028
10
+ model_compression_toolkit/core/runner.py,sha256=yref5I8eUo2A4hAmc4bOQOj6lUZRDQjLQR_5lJCjXiQ,12696
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
13
  model_compression_toolkit/core/common/framework_implementation.py,sha256=pOT9ZmRFL9FY92uUtigrO3sbWGiyVDhHAM1fbA4b5yo,20752
@@ -30,7 +30,7 @@ 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=VKw50YwgGfyA7sdtEeU9qaSDnN31p4fHX1JVx7wNF9c,38265
33
+ model_compression_toolkit/core/common/graph/base_graph.py,sha256=lmIw0srKiwCvz7KWqfwKTxyQHDy3s6rWMIXzFAa1UMo,38326
34
34
  model_compression_toolkit/core/common/graph/base_node.py,sha256=IaHrvgtUZvPshhUjS4j2lqIP22Mlny82BQZaL2iVJew,29079
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=71_4TrCdqR_r0mtgxmAyqI05iP5YoQQGeSmDgynuzTw,3902
@@ -69,7 +69,7 @@ model_compression_toolkit/core/common/mixed_precision/set_layer_to_bitwidth.py,s
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
71
71
  model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/resource_utilization.py,sha256=HILF7CIn-GYPvPmTFyvjWLhuLDwSGwdBcAaKFgVYrwk,4745
72
- model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/resource_utilization_data.py,sha256=mk4nSP3cJ-k_aKIyPW0zoAgoe_hHXXQcCygicWBBOjw,7922
72
+ model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/resource_utilization_data.py,sha256=MhmYgsybWJ2dlCwbZjDKJB8QlDHHy--zOBs2DwJB2e0,13820
73
73
  model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/ru_aggregation_methods.py,sha256=ttc8wPa_9LZansutQ2f1ss-RTzgTv739wy3qsdLzyyk,4217
74
74
  model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/ru_functions_mapping.py,sha256=QhuqaECEGLnYC08iD6-2XXcU7NXbPzYf1sQcjYlGak8,1682
75
75
  model_compression_toolkit/core/common/mixed_precision/resource_utilization_tools/ru_methods.py,sha256=TUGv_4j9-WUWZceoqLdObH_61tAQnHIRyquxm09x9wI,21473
@@ -84,26 +84,26 @@ model_compression_toolkit/core/common/pruning/channels_grouping.py,sha256=4jsr1x
84
84
  model_compression_toolkit/core/common/pruning/greedy_mask_calculator.py,sha256=cKcSkrQkTFm6Ns7Uq9IXWEMDPQfr9Ew9RvZXmr4p4cM,7928
85
85
  model_compression_toolkit/core/common/pruning/memory_calculator.py,sha256=doSxL7JnvcuxaANjE2fiG_yiRShLwDBtqNXnQyDtZ50,19523
86
86
  model_compression_toolkit/core/common/pruning/prune_graph.py,sha256=Sykf7m49krzINy_Sx9UBU_WF_WctewHArDQ4oFXVQUY,3323
87
- model_compression_toolkit/core/common/pruning/pruner.py,sha256=70x4eY-1efrDeev10esdCx5c6fFCGwqSV6U0rzPNZiE,7516
87
+ model_compression_toolkit/core/common/pruning/pruner.py,sha256=SIlO1A97MGhX-oBn5618zciUqVlZkQfTs873GF4MLxk,7536
88
88
  model_compression_toolkit/core/common/pruning/pruning_config.py,sha256=fbqERt11FGVeuqPVA6nVbgGDh6Ox9mpEKdxVJT8eG4I,3681
89
89
  model_compression_toolkit/core/common/pruning/pruning_framework_implementation.py,sha256=H2gnCv-lyRLXapDy71QHA3JkLYTQT1ni23nGTYErsZo,6734
90
- model_compression_toolkit/core/common/pruning/pruning_info.py,sha256=nT1aA1eYnai3SdGkBGjpvPgvsko7zf_4w2oiNYE2G7M,3781
90
+ model_compression_toolkit/core/common/pruning/pruning_info.py,sha256=qI1kXcoQR9D_GgzjKQ_EoML94VtAxxIF1LGnHWXtl24,3801
91
91
  model_compression_toolkit/core/common/pruning/pruning_section.py,sha256=I4vxh5iPKWs8yji-q4TVmaa6bcfLwT3ZhB2x8F8cJkU,5721
92
92
  model_compression_toolkit/core/common/pruning/importance_metrics/__init__.py,sha256=3Lkr37Exk9u8811hw8hVqkGcbTQGcLjd3LLuLC3fa_E,698
93
93
  model_compression_toolkit/core/common/pruning/importance_metrics/base_importance_metric.py,sha256=qMAtLWs5fjbSco8nhbig5TkuacdhnDW7cy3avMHRGX4,1988
94
94
  model_compression_toolkit/core/common/pruning/importance_metrics/importance_metric_factory.py,sha256=E-fKuRfrNYlN3nNcRAbnkJkFNwClvyrL_Js1qDPxIKA,1999
95
95
  model_compression_toolkit/core/common/pruning/importance_metrics/lfh_importance_metric.py,sha256=2WwX1omrMAYOsXCesP35g1p_8M6JviEUTkaSNaMIuaI,14027
96
96
  model_compression_toolkit/core/common/pruning/mask/__init__.py,sha256=huHoBUcKNB6BnY6YaUCcFvdyBtBI172ZoUD8ZYeNc6o,696
97
- model_compression_toolkit/core/common/pruning/mask/per_channel_mask.py,sha256=PdIfl3AMoCATfShimQjsJUszmeIO6eTtpp7B1ZZIc64,5111
98
- model_compression_toolkit/core/common/pruning/mask/per_simd_group_mask.py,sha256=h85ZM6N-tDhJB8EWXwHDBVEDnrIHt0fQfFguqqyOfTU,5958
97
+ model_compression_toolkit/core/common/pruning/mask/per_channel_mask.py,sha256=APY8BsM9B7ZxVCH6n1xs9fSCTB_A9ou9gHrCQl1DOdI,5131
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
100
  model_compression_toolkit/core/common/quantization/candidate_node_quantization_config.py,sha256=8RfAaVITnYpWQUvFnDDzLOteBtc5bN6JOzdyb-l768U,4900
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=q5e1XRIZc2APtdHRW_8bucoFqxaoc0srKWMUgYJ6dAM,26723
105
- model_compression_toolkit/core/common/quantization/quantization_config.py,sha256=Y76BZ-X2vE_PXeM9r7D93VsFnbC_evoHhN7zYuvFdzw,7041
106
- model_compression_toolkit/core/common/quantization/quantization_fn_selection.py,sha256=T1nVWdRJfBQ_iuMQYQSIkjfkR-2n3lAOKGAz_rUZZN0,2190
104
+ model_compression_toolkit/core/common/quantization/node_quantization_config.py,sha256=0XFJwHbuUjT_C20XB0Omumd6PSQqYj5fnsYHRx78AaU,26733
105
+ model_compression_toolkit/core/common/quantization/quantization_config.py,sha256=du0VdsxfkOSYaP1EU9gHA5qbXpfQNZL0jXrjk1wBA0U,7106
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
108
108
  model_compression_toolkit/core/common/quantization/quantize_graph_weights.py,sha256=N005MSvx8UypVpa7XrxNrB2G732n2wHj3RmLyjTgd3I,2728
109
109
  model_compression_toolkit/core/common/quantization/quantize_node.py,sha256=cdzGNWfT4MRogIU8ehs0tr3lVjnzAI-jeoS9b4TwVBo,2854
@@ -135,7 +135,7 @@ model_compression_toolkit/core/common/substitutions/batchnorm_reconstruction.py,
135
135
  model_compression_toolkit/core/common/substitutions/batchnorm_refusing.py,sha256=YqLKiO5gFBEvI6noAWeMME1JHaYUaGFMglVFg8AqGjc,10028
136
136
  model_compression_toolkit/core/common/substitutions/linear_collapsing.py,sha256=iEtzbWCDXP6EDkTZCtREQ0rpMxhQ2kM9zlcP_0KLq9I,12367
137
137
  model_compression_toolkit/core/common/substitutions/linear_collapsing_substitution.py,sha256=uoauhmncQqUBNvD-qCLIXsIbl_IzrbxSKdxiMig-5W4,2406
138
- model_compression_toolkit/core/common/substitutions/remove_identity.py,sha256=VUWjc9Wo_nwSX3JTyAtrG5mprV90DwaQopAuvND30nQ,2353
138
+ model_compression_toolkit/core/common/substitutions/remove_identity.py,sha256=TKU1TIU52UIkVnl0EZvWnDhLV9nIVZ4hqi-w1i4NXMk,2637
139
139
  model_compression_toolkit/core/common/substitutions/residual_collapsing.py,sha256=doErjlMq-uSObYMSjA6IywSHb3Hz3QCc0HKU68ccrQ4,4767
140
140
  model_compression_toolkit/core/common/substitutions/scale_equalization.py,sha256=p57u25qdW2pimxzGwgMXEBV4S-LzXuTVAlIM7830WfU,10966
141
141
  model_compression_toolkit/core/common/substitutions/shift_negative_activation.py,sha256=cyy4qnlD-v1Gou62oHNDsf1hWLWkYfcjVv1otFrUltY,29865
@@ -149,43 +149,43 @@ model_compression_toolkit/core/common/visualization/tensorboard_writer.py,sha256
149
149
  model_compression_toolkit/core/keras/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7VclGVOQ63x2p6mAAuba4,698
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
- model_compression_toolkit/core/keras/default_framework_info.py,sha256=Ha4HTHuiw_KTS5Po1Xnv6GyK9eprpDhYWf-eooS62Ys,4961
153
- model_compression_toolkit/core/keras/keras_implementation.py,sha256=04vZfpSzDq8jwUlsT88FXp4ngTnTIxKVdIxiYWAwmbg,29673
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=CijrPTyh28Up9-_YYrGNxaflLMAK5CzbXMraAGnX6l4,29716
154
154
  model_compression_toolkit/core/keras/keras_model_validation.py,sha256=1wNV2clFdC9BzIELRLSO2uKf0xqjLqlkTJudwtCeaJk,1722
155
- model_compression_toolkit/core/keras/keras_node_prior_info.py,sha256=TIqazcbeoMxZgneQ-i24myCPyBpy_RJ7GcDxxWHbb4U,3907
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
157
  model_compression_toolkit/core/keras/tf_tensor_numpy.py,sha256=moMFP7hOagAbd09bWa2AX5uxN7XOJqLB-mV3mA30kLQ,2651
158
158
  model_compression_toolkit/core/keras/back2framework/__init__.py,sha256=rhIiXg_nBgUZ-baE3M6SzCuQbcnq4iebY1jtJBvKHOM,808
159
159
  model_compression_toolkit/core/keras/back2framework/factory_model_builder.py,sha256=urpfyHvIzD08QzPBWusVBT_dKZ8ZUf1I1zIQNb4qe5Y,2233
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
- model_compression_toolkit/core/keras/back2framework/keras_model_builder.py,sha256=7xEasszjyqbkv5UJuBfEr2kxRPtcrdNP26ivELoIVI4,16227
163
- model_compression_toolkit/core/keras/back2framework/mixed_precision_model_builder.py,sha256=psJzQJ_Hv_wyHuXZotN5dopwoKIu87-xnaILfINWXf0,15567
162
+ model_compression_toolkit/core/keras/back2framework/keras_model_builder.py,sha256=KXA5rik1cvCSgIbybPfX3tsMlzoILDboVONGyqzXGh0,16290
163
+ model_compression_toolkit/core/keras/back2framework/mixed_precision_model_builder.py,sha256=ygIS1WIiftF1VC3oGhc8N6j7MryKtWgEg8nr50p7f4U,15587
164
164
  model_compression_toolkit/core/keras/back2framework/quantized_model_builder.py,sha256=5wFb4nx_F0Wu4c8pLf6n6OzxOHtpOJ6_3mQsNSXIudU,2481
165
165
  model_compression_toolkit/core/keras/graph_substitutions/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7VclGVOQ63x2p6mAAuba4,698
166
166
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7VclGVOQ63x2p6mAAuba4,698
167
- model_compression_toolkit/core/keras/graph_substitutions/substitutions/activation_decomposition.py,sha256=3FVqVfEeEve8vRejmMex079HZDnoRsF21kNY53ZjIM8,5140
167
+ model_compression_toolkit/core/keras/graph_substitutions/substitutions/activation_decomposition.py,sha256=Hs96qwrwhMqnMrjALN-jtsGiuiEU2ZtE6BmC1DoMV-Y,5160
168
168
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/batchnorm_folding.py,sha256=Oe2QNsU49rp6qW1jUuOG_fKrE3DqXXDmVWN0fiyWo4c,8207
169
169
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/batchnorm_reconstruction.py,sha256=GR1a3mCZpNUu4WxixJXF_aSm57phAdxaRoHecNx3hxw,3168
170
170
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/batchnorm_refusing.py,sha256=5df_xGfXkqNub4xVRnCWQvSohWqdv12axjJ6edVU2H0,2478
171
171
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/concat_threshold_update.py,sha256=Hl4LEQ_bw_Vpmf3ZqHujYUqVdvTNsPlEMvr9dZhwg2U,2806
172
172
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/dwconv_to_conv.py,sha256=R3U7cjc2E0zheMem16GHygp5jZFGSaomkNOTxTjcAgw,5794
173
173
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/input_scaling.py,sha256=V6hp67CkS_A3WqdsjLjs0ETtdZAOo4P9mhy4aT7W5FE,5940
174
- model_compression_toolkit/core/keras/graph_substitutions/substitutions/linear_collapsing.py,sha256=CjBbw20BcD9NFBftc9d28TYLmBI9wUzjfZ33c22hgHU,8157
174
+ model_compression_toolkit/core/keras/graph_substitutions/substitutions/linear_collapsing.py,sha256=i5kdo6-GJe5j4ZVoBp9irLLqqS_H24izrUvda17laf0,8177
175
175
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/matmul_substitution.py,sha256=kjwlKtm5yhNgWVVcW6mN-hn7enwAnn_8-TUZvxZBiQs,4112
176
176
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/multi_head_attention_decomposition.py,sha256=l9PUREBf4aRwWILiybdteveeUbh7js-i-hLt8Ma0e4c,26771
177
177
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/relu_bound_to_power_of_2.py,sha256=IdKOg6AWZWMcmDbOuNdxetS5_zTarXIIffdYL7JTdvk,3872
178
178
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/remove_identity.py,sha256=z2J2Xk7b_w_fEgJmK87lwwBmEoAZpGxPmsBrR24IkZs,2035
179
- model_compression_toolkit/core/keras/graph_substitutions/substitutions/residual_collapsing.py,sha256=MdRl2CLF_EsjHcpqa_kzgD7gKZI1kM4E1qDLarCH9Cw,3188
179
+ model_compression_toolkit/core/keras/graph_substitutions/substitutions/residual_collapsing.py,sha256=jhOLZDQ4_6-x6JHGsyzboX-CdtF3N-BkZjm2YwBsW4I,3208
180
180
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/scale_equalization.py,sha256=ryes9y1ie-vjBGso2TeO4EXxVk69Ew3iSAhshPz1Ou4,5542
181
181
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/separableconv_decomposition.py,sha256=TEaHlIbXj_ZjIdT5TmAICD3WLD3u_7g0fLWQcNzTJuM,7941
182
- model_compression_toolkit/core/keras/graph_substitutions/substitutions/shift_negative_activation.py,sha256=JCK--hQMKzbx4MOQZBPZqK015JWZELUO5YdA30IU4bI,11149
182
+ model_compression_toolkit/core/keras/graph_substitutions/substitutions/shift_negative_activation.py,sha256=13ejpU2z7c5O2w0Iy_uz3HaBbXVYrsQpEqt0nKErVvg,11169
183
183
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/softmax_shift.py,sha256=Qk5seDALj_th9dHJehY7ynZjvFjVfCv_mJ1enA5hX0c,1623
184
184
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/virtual_activation_weights_composition.py,sha256=wH9ocMLL725-uUPU-zCxdd8NwT5nyd0ZShmI7iuTwF8,1462
185
185
  model_compression_toolkit/core/keras/graph_substitutions/substitutions/weights_activation_split.py,sha256=rjIheZW7LbSPv9bzMSmC8wl6UUxaTkd4J2IHinObT-Y,1814
186
186
  model_compression_toolkit/core/keras/hessian/__init__.py,sha256=lNJ29DYxaLUPDstRDA1PGI5r9Fulq_hvrZMlhst1Z5g,697
187
187
  model_compression_toolkit/core/keras/hessian/activation_trace_hessian_calculator_keras.py,sha256=IBrHt4NfZwsoz_UHaXhfWVTQ8ihDNy1Ca88oBPtytHU,9656
188
- model_compression_toolkit/core/keras/hessian/trace_hessian_calculator_keras.py,sha256=2TGEz6APP6iEGGzH82c5ba8mrMsfPuCTGkfS_GLm8vQ,3913
188
+ model_compression_toolkit/core/keras/hessian/trace_hessian_calculator_keras.py,sha256=hRfAjgZakDaIMuERmTVjJSa_Ww6FmEudYPO9R7SuYuQ,3914
189
189
  model_compression_toolkit/core/keras/hessian/weights_trace_hessian_calculator_keras.py,sha256=ZXiN6D1kW5a_-02wk_YgjBEiKkNpz_cajP6842ysGAc,10525
190
190
  model_compression_toolkit/core/keras/mixed_precision/__init__.py,sha256=sw7LOPN1bM82o3SkMaklyH0jw-TLGK0-fl2Wq73rffI,697
191
191
  model_compression_toolkit/core/keras/mixed_precision/configurable_activation_quantizer.py,sha256=aW8wR13fK6P6xzbU9XGU60IO1yYzXSo_Hk4qeq486kg,5137
@@ -194,10 +194,10 @@ model_compression_toolkit/core/keras/pruning/__init__.py,sha256=3Lkr37Exk9u8811h
194
194
  model_compression_toolkit/core/keras/pruning/pruning_keras_implementation.py,sha256=EJkblZ4OAjI5l29GKsUraam5Jn58Sogld47_rFFyr3k,12777
195
195
  model_compression_toolkit/core/keras/quantizer/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7VclGVOQ63x2p6mAAuba4,698
196
196
  model_compression_toolkit/core/keras/quantizer/base_quantizer.py,sha256=eMRjAUU189-AVwNGMlV0M-ZlL48ZYmILzutheUT00xU,1628
197
- model_compression_toolkit/core/keras/quantizer/fake_quant_builder.py,sha256=ymBSCN7IeJnS305fpVO866WJxW456yV8cZAD4kMD308,6274
197
+ model_compression_toolkit/core/keras/quantizer/fake_quant_builder.py,sha256=vfKwU0AfRH2KztmMF5bxcaBlGdnTePPGZsUqOHzED-U,6854
198
198
  model_compression_toolkit/core/keras/quantizer/lut_fake_quant.py,sha256=Up3-sbuAcaJ6kfe7Sz3XN6iiJ9hlxzOMncLCFEXJFjk,4475
199
199
  model_compression_toolkit/core/keras/reader/__init__.py,sha256=mjbqLD-KcG3eNeCYpu1GBS7VclGVOQ63x2p6mAAuba4,698
200
- model_compression_toolkit/core/keras/reader/common.py,sha256=lVy_dRfIfx4mrijdh8HO9HAx4Jq7QyLY9VGB6dxwDx8,2518
200
+ model_compression_toolkit/core/keras/reader/common.py,sha256=eZWjBcvTDUX7fCWmy1OAH4lYLFTh59_UQ_nP_Gjp4yw,2594
201
201
  model_compression_toolkit/core/keras/reader/connectivity_handler.py,sha256=AgF6qXZOJMeXvc-pBnGY23BJz7wPBx2aTYxHiO8efec,11303
202
202
  model_compression_toolkit/core/keras/reader/node_builder.py,sha256=URmE3lM9CskS-9a3TuqfReLdHh36Dti08RL8qxzrBjc,10471
203
203
  model_compression_toolkit/core/keras/reader/reader.py,sha256=wS9UQ2wJKnkZYe9JHwQp7ygDr6CRlzrxmIyLDv1Qz6U,8109
@@ -212,7 +212,7 @@ model_compression_toolkit/core/keras/visualization/__init__.py,sha256=mjbqLD-KcG
212
212
  model_compression_toolkit/core/pytorch/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
213
213
  model_compression_toolkit/core/pytorch/constants.py,sha256=NI-J7REuxn06oEIHsmJ4GqtNC3TbV8xlkJjt5Ar-c4U,2626
214
214
  model_compression_toolkit/core/pytorch/default_framework_info.py,sha256=r1XyzUFvrjGcJHQM5ETLsMZIG2yHCr9HMjqf0ti9inw,4175
215
- model_compression_toolkit/core/pytorch/pytorch_device_config.py,sha256=IoMvTch5awAEPvB6Tg6ANhFGXvfSgv7JLsUBlxpMwk4,4330
215
+ model_compression_toolkit/core/pytorch/pytorch_device_config.py,sha256=S25cuw10AW3SEN_fRAGRcG_I3wdvvQx1ehSJzPnn-UI,4404
216
216
  model_compression_toolkit/core/pytorch/pytorch_implementation.py,sha256=sEtlxpWdt0rzuTN3R0bNCC_l75Xy7rIBMUWY7LuhYKI,27351
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
@@ -220,9 +220,9 @@ model_compression_toolkit/core/pytorch/utils.py,sha256=dRPiteBg2dBNsHwZyYzXiCIAj
220
220
  model_compression_toolkit/core/pytorch/back2framework/__init__.py,sha256=H_WixgN0elVWf3exgGYsi58imPoYDj5eYPeh6x4yfug,813
221
221
  model_compression_toolkit/core/pytorch/back2framework/factory_model_builder.py,sha256=DwNO8WO3JiMawKGKDhlrwCoCjMSBIw5BMbsFFF7eDS4,2279
222
222
  model_compression_toolkit/core/pytorch/back2framework/float_model_builder.py,sha256=tLrlUyYhxVKVjkad1ZAtbRra0HedB3iVfIkZ_dYnQ-4,3419
223
- model_compression_toolkit/core/pytorch/back2framework/instance_builder.py,sha256=BxX0e6kKoV29UNT-Yee28f7rXID5_KBz1RiSDYo2Vjk,1848
223
+ model_compression_toolkit/core/pytorch/back2framework/instance_builder.py,sha256=d7U_8VKGjQjbmvcUKRKsD80woWu_0gh6LXg1NhZNTjY,1348
224
224
  model_compression_toolkit/core/pytorch/back2framework/mixed_precision_model_builder.py,sha256=D7lU1r9Uq_7fdNuKk2BMF8ho5GrsY-8gyGN6yYoHaVg,15060
225
- model_compression_toolkit/core/pytorch/back2framework/pytorch_model_builder.py,sha256=i0U4EQfaTbbBHMrv9oJHJ5ltybfGTGz17KETnNpci3k,18299
225
+ model_compression_toolkit/core/pytorch/back2framework/pytorch_model_builder.py,sha256=11pUQUxtBM1gCxipEaXn-8A9dVI5rgRiSoFa9i_nw58,18281
226
226
  model_compression_toolkit/core/pytorch/back2framework/quantized_model_builder.py,sha256=qZNNOlNTTV4ZKPG3q5GDXkIVTPUEr8dvxAS_YiMORmg,3456
227
227
  model_compression_toolkit/core/pytorch/back2framework/quantization_wrapper/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
228
228
  model_compression_toolkit/core/pytorch/back2framework/quantization_wrapper/quantized_layer_wrapper.py,sha256=q2JDw10NKng50ee2i9faGzWZ-IydnR2aOMGSn9RoZmc,5773
@@ -236,13 +236,13 @@ model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/concat_
236
236
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/const_holder_conv.py,sha256=Fs2YQBD4KJV-pGLOMqm-p485bfq2JDYgCzFroRljCoM,3933
237
237
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/functional_batch_norm.py,sha256=iX8bLHtw2osP42-peNLTRmbpX3cUxdGsAbEfw7NLpx0,3935
238
238
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/functional_layer_norm.py,sha256=zKSgtVw_P9fUvdq4e7P9yaLDPG_vZ0cecM9sVPtm1ns,3799
239
- model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/linear_collapsing.py,sha256=8KtuyqKgu7VTk6zffTmIteZ5Eq90ffPXgYWqca0NZj0,5829
239
+ model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/linear_collapsing.py,sha256=CXSMASpc_Zed3BJ2CsER69zKxE6ncFvvKQWDO1JxKYI,5849
240
240
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/multi_head_attention_decomposition.py,sha256=VNg-VgzCxSyqy2J3neEPl6U0SPO8UIVU_T47bGhz4FE,38459
241
241
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/permute_call_method.py,sha256=EMCviyFyJFLEKuAUz3rZHLfB9MAU1kywSBL2XQNzLlg,1953
242
242
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/relu_bound_to_power_of_2.py,sha256=q1a3HieQtaOmWG2WGXp6GHYAvxa3CZ9dJUx9dqMAsS8,5695
243
243
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/remove_identity.py,sha256=joHjwiUxccypMHkTy46rI91VyapLn9yJ2YRo5ISnOH4,1987
244
244
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/reshape_with_static_shapes.py,sha256=jOqlelGhADEZiYUEyYj9oJZ5YLXx8jWNUlVTG6Td79Y,4919
245
- model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/residual_collapsing.py,sha256=flHJU-hSvih3bi8c24SYArqN00UnOVImu8HZBZAzzVo,2909
245
+ model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/residual_collapsing.py,sha256=DcJEIkGvBdIMOelNIwaJUZ5UsAHiGnDJPR20I464vWo,2929
246
246
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/scale_equalization.py,sha256=XFtU9yuBmoZlX0f0mS6otMPWMk-RcWs94XdvvTNhW8Y,3303
247
247
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/shift_negative_activation.py,sha256=lOPl5zDU3FoR9WmlxO04Pfi65MimK0gmnuHzQJodQdY,10668
248
248
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/softmax_shift.py,sha256=05lV4pIL3hJkZl4JQPV4wk_EFD0eYLG5b8cdzvZk4P8,1588
@@ -250,7 +250,7 @@ model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/virtual
250
250
  model_compression_toolkit/core/pytorch/graph_substitutions/substitutions/weights_activation_split.py,sha256=tp78axmUQc0Zpj3KwVmV0PGYHvCf7sAW_sRmXXw7gsY,1616
251
251
  model_compression_toolkit/core/pytorch/hessian/__init__.py,sha256=lNJ29DYxaLUPDstRDA1PGI5r9Fulq_hvrZMlhst1Z5g,697
252
252
  model_compression_toolkit/core/pytorch/hessian/activation_trace_hessian_calculator_pytorch.py,sha256=9yD0zAcERmZkwzUJkTMq_rZp9bIUCIPSsB4HE-53MFo,8147
253
- model_compression_toolkit/core/pytorch/hessian/trace_hessian_calculator_pytorch.py,sha256=BBZjM71V9YwlCMe380D7VQoBzXxHQpiPLvNIemyH-3g,3425
253
+ model_compression_toolkit/core/pytorch/hessian/trace_hessian_calculator_pytorch.py,sha256=Gat9aobUOQEWGt02x30vVm04mdi3gchdz2Bmmw5p91w,3445
254
254
  model_compression_toolkit/core/pytorch/hessian/weights_trace_hessian_calculator_pytorch.py,sha256=ODktCLPovOgrvYGHKtSD8es5p2BxMC--9t7fkp04tyo,6974
255
255
  model_compression_toolkit/core/pytorch/mixed_precision/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
256
256
  model_compression_toolkit/core/pytorch/mixed_precision/configurable_activation_quantizer.py,sha256=-6oep2WJ85-JmIxZa-e2AmBpbORoKe4Xdduz2ZidwvM,4871
@@ -258,7 +258,7 @@ model_compression_toolkit/core/pytorch/mixed_precision/configurable_weights_quan
258
258
  model_compression_toolkit/core/pytorch/pruning/__init__.py,sha256=RAe8mgIr1V8dRIQtLf_dSG5zTUCKuQzxyybYx1dzEAs,697
259
259
  model_compression_toolkit/core/pytorch/pruning/pruning_pytorch_implementation.py,sha256=VfEEVwWEXKpVlZFnr7N6mvEjcpq85ROLg05ZvXfD1Pg,14764
260
260
  model_compression_toolkit/core/pytorch/quantizer/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
261
- model_compression_toolkit/core/pytorch/quantizer/fake_quant_builder.py,sha256=rox-f5wbRyxU1UHeHyaoIDXB9r9fCXm1dPN4FVwHqTc,6464
261
+ model_compression_toolkit/core/pytorch/quantizer/fake_quant_builder.py,sha256=D8_CEuFqKAhbUgKaRw7Jlxo0zlqgPTMu6CIIIM4LfS0,7045
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=8EieykOysQEMoHZQTLZv9yfkg0dkoFwRtlR3I0rlshg,12626
@@ -273,8 +273,8 @@ model_compression_toolkit/data_generation/common/data_generation.py,sha256=fccGG
273
273
  model_compression_toolkit/data_generation/common/data_generation_config.py,sha256=ynyNaT2x2d23bYSrO2sRItM2ZsjGD0K0fM71FlibiJQ,4564
274
274
  model_compression_toolkit/data_generation/common/enums.py,sha256=OGnvtEGFbP5l4V3-1l32zzVQwTb1vGJhTVF0kOkYZK4,3584
275
275
  model_compression_toolkit/data_generation/common/image_pipeline.py,sha256=WwyeoIvgmcxKnuOX-_Hl_0APET4M26f5x-prhUB3qvU,2149
276
- model_compression_toolkit/data_generation/common/model_info_exctractors.py,sha256=EspXpsimTuGIpF6Pg4OMixZ4z7Zg778aYioMOE30hmo,6046
277
- model_compression_toolkit/data_generation/common/optimization_utils.py,sha256=8wCU-bCLabDIUayG3eyapdD8pTE6x0RYG5o3rfha7XE,19572
276
+ model_compression_toolkit/data_generation/common/model_info_exctractors.py,sha256=kz3w4h4fO4R2N5IgLvSkqDUwjhH4S-I3n3_pK2hQ_uo,6200
277
+ model_compression_toolkit/data_generation/common/optimization_utils.py,sha256=Q_yG8T8HQxfTKjVmN7bLm4M4y-5WrMeGQ_h5RnurSmg,19761
278
278
  model_compression_toolkit/data_generation/keras/__init__.py,sha256=lNJ29DYxaLUPDstRDA1PGI5r9Fulq_hvrZMlhst1Z5g,697
279
279
  model_compression_toolkit/data_generation/keras/constants.py,sha256=uy3eU24ykygIrjIvwOMj3j5euBeN2PwWiEFPOkJJ7ss,1088
280
280
  model_compression_toolkit/data_generation/keras/image_pipeline.py,sha256=_Qezq67huKmmNsxdFBBrTY-VaGR-paFzDH80dDuRnug,7623
@@ -338,7 +338,7 @@ model_compression_toolkit/gptq/common/gptq_config.py,sha256=6xP99B-lK1bwGv3Adqxn
338
338
  model_compression_toolkit/gptq/common/gptq_constants.py,sha256=QSm6laLkIV0LYmU0BLtmKp3Fi3SqDfbncFQWOGA1cGU,611
339
339
  model_compression_toolkit/gptq/common/gptq_framework_implementation.py,sha256=n3mSf4J92kFjekzyGyrJULylI-8Jf5OVWJ5AFoVnEx0,1266
340
340
  model_compression_toolkit/gptq/common/gptq_graph.py,sha256=-bL5HhPcKqV8nj4dZPXc5QmQJbFBel6etrioikP0tEo,3039
341
- model_compression_toolkit/gptq/common/gptq_training.py,sha256=rLA1xlOO-6gWfmc2dLWr1E8dRvTE76vkUYA5eH-MMTA,17705
341
+ model_compression_toolkit/gptq/common/gptq_training.py,sha256=v_R24lW74XpAISK9D3P4U-xYyeWbH7obAdqo3f-WCis,16093
342
342
  model_compression_toolkit/gptq/keras/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
343
343
  model_compression_toolkit/gptq/keras/gptq_keras_implementation.py,sha256=axBwnCSjq5xk-xGymOwSOqjp39It-CVtGcCTRTf0E_4,1248
344
344
  model_compression_toolkit/gptq/keras/gptq_loss.py,sha256=rbRkF15MYd6nq4G49kcjb_dPTa-XNq9cTkrb93mXawo,6241
@@ -476,15 +476,15 @@ model_compression_toolkit/trainable_infrastructure/common/get_quantizers.py,sha2
476
476
  model_compression_toolkit/trainable_infrastructure/common/quant_utils.py,sha256=zdiew1jwR7tUKm9XWlHnAPxIZsAdKqbzzC2vH02j5wA,1505
477
477
  model_compression_toolkit/trainable_infrastructure/common/trainable_quantizer_config.py,sha256=My5Wz34jPOyh8z33OTpKnOobRB0cpO_Qgmtsd5lizHo,4791
478
478
  model_compression_toolkit/trainable_infrastructure/keras/__init__.py,sha256=huHoBUcKNB6BnY6YaUCcFvdyBtBI172ZoUD8ZYeNc6o,696
479
- model_compression_toolkit/trainable_infrastructure/keras/base_keras_quantizer.py,sha256=-Lrp9tW4WDfgjTgSRYGSCQaQZullhFvdVcJiVRS5Is0,4148
479
+ model_compression_toolkit/trainable_infrastructure/keras/base_keras_quantizer.py,sha256=HYJxTS_z1xBL5GzA3vQzYWMSPZW29cR3hvhvoBi-BaE,3996
480
480
  model_compression_toolkit/trainable_infrastructure/keras/config_serialization.py,sha256=txdWXdZoHazg-3MDPb9P-oXRM92LRn2G_8woEplwKaI,4360
481
481
  model_compression_toolkit/trainable_infrastructure/keras/load_model.py,sha256=-g-php71ezRZg1viD1MjMQ-GEyBua-PVd5XoSBvwzpc,3656
482
482
  model_compression_toolkit/trainable_infrastructure/keras/quantize_wrapper.py,sha256=ZdYRQaBtKbckwodcN2yfVx4Bc6LrcoUG-kDKc7mW12U,5468
483
483
  model_compression_toolkit/trainable_infrastructure/keras/quantizer_utils.py,sha256=MVwXNymmFRB2NXIBx4e2mdJ1RfoHxRPYRgjb1MQP5kY,1797
484
484
  model_compression_toolkit/trainable_infrastructure/pytorch/__init__.py,sha256=huHoBUcKNB6BnY6YaUCcFvdyBtBI172ZoUD8ZYeNc6o,696
485
- model_compression_toolkit/trainable_infrastructure/pytorch/base_pytorch_quantizer.py,sha256=7bbzqJN8ZAycVDvZr_5xC-niTAR5df8f03Kooev_pfg,3047
486
- mct_nightly-2.0.0.20240505.435.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
487
- mct_nightly-2.0.0.20240505.435.dist-info/METADATA,sha256=J28yFDrtPkYv6eU9vZDNBf64nNJ6cooZOZx53quyV-o,18795
488
- mct_nightly-2.0.0.20240505.435.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
489
- mct_nightly-2.0.0.20240505.435.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
490
- mct_nightly-2.0.0.20240505.435.dist-info/RECORD,,
485
+ model_compression_toolkit/trainable_infrastructure/pytorch/base_pytorch_quantizer.py,sha256=MxylaVFPgN7zBiRBy6WV610EA4scLgRJFbMucKvvNDU,2896
486
+ mct_nightly-2.0.0.20240507.417.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
487
+ mct_nightly-2.0.0.20240507.417.dist-info/METADATA,sha256=APEbUGYqsswtu0ffovcmEiNtGhuzoQ3wranHLhEkNB4,18795
488
+ mct_nightly-2.0.0.20240507.417.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
489
+ mct_nightly-2.0.0.20240507.417.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
490
+ mct_nightly-2.0.0.20240507.417.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.0.0.20240505.000435"
30
+ __version__ = "2.0.0.20240507.000417"
@@ -414,7 +414,7 @@ class Graph(nx.MultiDiGraph, GraphSearches):
414
414
 
415
415
  """
416
416
  if new_node is None:
417
- Logger.critical("Cannot replace input node with a None value; new input node is required.")
417
+ Logger.critical("Cannot replace input node with a None value; new input node is required.") # pragma: no cover
418
418
 
419
419
  graph_inputs = self.get_inputs()
420
420
  new_graph_inputs = copy(graph_inputs)
@@ -828,12 +828,12 @@ class Graph(nx.MultiDiGraph, GraphSearches):
828
828
 
829
829
  """
830
830
  if not fw_impl.is_node_entry_node(entry_node):
831
- Logger.critical(f"Node {entry_node} is not a valid entry node for creating a pruning section")
831
+ Logger.critical(f"Node {entry_node} is not a valid entry node for creating a pruning section") # pragma: no cover
832
832
 
833
833
  intermediate_nodes, exit_node = self._find_intermediate_and_exit_nodes(entry_node, fw_impl)
834
834
 
835
835
  if not fw_impl.is_node_exit_node(exit_node, entry_node, self.fw_info):
836
- Logger.critical(f"Node {exit_node} is not a valid exit node for the pruning section starting with {entry_node}.")
836
+ Logger.critical(f"Node {exit_node} is not a valid exit node for the pruning section starting with {entry_node}.") # pragma: no cover
837
837
 
838
838
  return PruningSection(entry_node=entry_node,
839
839
  intermediate_nodes=intermediate_nodes,
@@ -13,15 +13,16 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
  import numpy as np
16
- from typing import Callable, Any
16
+ from typing import Callable, Any, Dict, Tuple
17
17
 
18
- from model_compression_toolkit.constants import FLOAT_BITWIDTH
18
+ from model_compression_toolkit.constants import FLOAT_BITWIDTH, BITS_TO_BYTES
19
19
  from model_compression_toolkit.core import FrameworkInfo, ResourceUtilization, CoreConfig
20
20
  from model_compression_toolkit.core.common import Graph
21
21
  from model_compression_toolkit.core.common.framework_implementation import FrameworkImplementation
22
22
  from model_compression_toolkit.core.common.graph.edge import EDGE_SINK_INDEX
23
23
  from model_compression_toolkit.core.graph_prep_runner import graph_preparation_runner
24
- from model_compression_toolkit.target_platform_capabilities.target_platform import TargetPlatformCapabilities
24
+ from model_compression_toolkit.target_platform_capabilities.target_platform import TargetPlatformCapabilities, \
25
+ QuantizationConfigOptions
25
26
 
26
27
 
27
28
  def compute_resource_utilization_data(in_model: Any,
@@ -29,10 +30,13 @@ def compute_resource_utilization_data(in_model: Any,
29
30
  core_config: CoreConfig,
30
31
  tpc: TargetPlatformCapabilities,
31
32
  fw_info: FrameworkInfo,
32
- fw_impl: FrameworkImplementation) -> ResourceUtilization:
33
+ fw_impl: FrameworkImplementation,
34
+ transformed_graph: Graph = None,
35
+ mixed_precision_enable: bool = True) -> ResourceUtilization:
33
36
  """
34
37
  Compute Resource Utilization information that can be relevant for defining target ResourceUtilization for mixed precision search.
35
- Calculates maximal activation tensor, sum of weights' parameters and total (sum of both).
38
+ Calculates maximal activation tensor size, the sum of the model's weight parameters and the total memory combining both weights
39
+ and maximal activation tensor size.
36
40
 
37
41
  Args:
38
42
  in_model: Model to build graph from (the model that intended to be quantized).
@@ -42,27 +46,35 @@ def compute_resource_utilization_data(in_model: Any,
42
46
  the attached framework operator's information.
43
47
  fw_info: Information needed for quantization about the specific framework.
44
48
  fw_impl: FrameworkImplementation object with a specific framework methods implementation.
49
+ transformed_graph: An internal graph representation of the input model. Defaults to None.
50
+ If no graph is provided, a graph will be constructed using the specified model.
51
+ mixed_precision_enable: Indicates if mixed precision is enabled, defaults to True.
52
+ If disabled, computes resource utilization using base quantization
53
+ configurations across all layers.
54
+
55
+ Returns:
56
+ ResourceUtilization: An object encapsulating the calculated resource utilization computations.
45
57
 
46
- Returns: A ResourceUtilization object with the results.
47
58
 
48
59
  """
49
60
 
50
61
  # We assume that the resource_utilization_data API is used to compute the model resource utilization for
51
62
  # mixed precision scenario, so we run graph preparation under the assumption of enabled mixed precision.
52
- transformed_graph = graph_preparation_runner(in_model,
53
- representative_data_gen,
54
- core_config.quantization_config,
55
- fw_info,
56
- fw_impl,
57
- tpc,
58
- mixed_precision_enable=True)
63
+ if transformed_graph is None:
64
+ transformed_graph = graph_preparation_runner(in_model,
65
+ representative_data_gen,
66
+ core_config.quantization_config,
67
+ fw_info,
68
+ fw_impl,
69
+ tpc,
70
+ mixed_precision_enable=mixed_precision_enable)
59
71
 
60
72
  # Compute parameters sum
61
- weights_params = compute_nodes_weights_params(graph=transformed_graph, fw_info=fw_info)
73
+ weights_memory_bytes, weights_params = compute_nodes_weights_params(graph=transformed_graph, fw_info=fw_info)
62
74
  total_weights_params = 0 if len(weights_params) == 0 else sum(weights_params)
63
75
 
64
76
  # Compute max activation tensor
65
- activation_output_sizes = compute_activation_output_sizes(graph=transformed_graph)
77
+ activation_output_sizes_bytes, activation_output_sizes = compute_activation_output_sizes(graph=transformed_graph)
66
78
  max_activation_tensor_size = 0 if len(activation_output_sizes) == 0 else max(activation_output_sizes)
67
79
 
68
80
  # Compute total memory utilization - parameters sum + max activation tensor
@@ -78,20 +90,23 @@ def compute_resource_utilization_data(in_model: Any,
78
90
  bops=bops_count)
79
91
 
80
92
 
81
- def compute_nodes_weights_params(graph: Graph, fw_info: FrameworkInfo) -> np.ndarray:
93
+ def compute_nodes_weights_params(graph: Graph, fw_info: FrameworkInfo) -> Tuple[np.ndarray, np.ndarray]:
82
94
  """
83
- Computes a vector with the respective weights' parameters size for each node.
95
+ Calculates the memory usage in bytes and the number of weight parameters for each node within a graph.
96
+ Memory calculations are based on the maximum bit-width used for quantization per node.
84
97
 
85
98
  Args:
86
- graph: Finalized Graph object.
87
- fw_info: FrameworkInfo object about the specific framework
88
- (e.g., attributes of different layers' weights to quantize).
89
-
90
- Returns: A vector of node's weights memory sizes.
91
-
99
+ graph: A finalized Graph object, representing the model structure.
100
+ fw_info: FrameworkInfo object containing details about the specific framework's
101
+ quantization attributes for different layers' weights.
102
+
103
+ Returns:
104
+ A tuple containing two arrays:
105
+ - The first array represents the memory in bytes for each node's weights when quantized at the maximal bit-width.
106
+ - The second array represents the total number of weight parameters for each node.
92
107
  """
93
-
94
108
  weights_params = []
109
+ weights_memory_bytes = []
95
110
  for n in graph.nodes:
96
111
  # TODO: when enabling multiple attribute quantization by default (currently,
97
112
  # only kernel quantization is enabled) we should include other attributes memory in the sum of all
@@ -100,7 +115,9 @@ def compute_nodes_weights_params(graph: Graph, fw_info: FrameworkInfo) -> np.nda
100
115
  kernel_attr = fw_info.get_kernel_op_attributes(n.type)[0]
101
116
  if kernel_attr is not None and not n.reuse:
102
117
  kernel_candidates = n.get_all_weights_attr_candidates(kernel_attr)
118
+
103
119
  if len(kernel_candidates) > 0 and any([c.enable_weights_quantization for c in kernel_candidates]):
120
+ max_weight_bits = max([kc.weights_n_bits for kc in kernel_candidates])
104
121
  node_num_weights_params = 0
105
122
  for attr in fw_info.get_kernel_op_attributes(n.type):
106
123
  if attr is not None:
@@ -108,28 +125,41 @@ def compute_nodes_weights_params(graph: Graph, fw_info: FrameworkInfo) -> np.nda
108
125
 
109
126
  weights_params.append(node_num_weights_params)
110
127
 
111
- return np.array(weights_params)
128
+ # multiply num params by num bits and divide by BITS_TO_BYTES to convert from bits to bytes
129
+ weights_memory_bytes.append(node_num_weights_params * max_weight_bits / BITS_TO_BYTES)
112
130
 
131
+ return np.array(weights_memory_bytes), np.array(weights_params)
113
132
 
114
- def compute_activation_output_sizes(graph: Graph) -> np.ndarray:
133
+ def compute_activation_output_sizes(graph: Graph) -> Tuple[np.ndarray, np.ndarray]:
115
134
  """
116
- Computes a vector with the respective output tensor size for each node.
135
+ Computes an array of the respective output tensor size and an array of the output tensor size in bytes for
136
+ each node.
117
137
 
118
138
  Args:
119
- graph: Finalized Graph object.
139
+ graph: A finalized Graph object, representing the model structure.
140
+
141
+ Returns:
142
+ A tuple containing two arrays:
143
+ - The first array represents the size of each node's activation output tensor size in bytes,
144
+ calculated using the maximal bit-width for quantization.
145
+ - The second array represents the size of each node's activation output tensor size.
120
146
 
121
- Returns: A vector of node's activation output size.
122
147
 
123
148
  """
124
149
 
125
150
  activation_outputs = []
126
- # Go over all nodes that have configurable activation.
151
+ activation_outputs_bytes = []
127
152
  for n in graph.nodes:
153
+ # Go over all nodes that have configurable activation.
128
154
  if n.has_activation_quantization_enabled_candidate():
155
+ # Fetch maximum bits required for quantizing activations
156
+ max_activation_bits = max([qc.activation_quantization_cfg.activation_n_bits for qc in n.candidates_quantization_cfg])
129
157
  node_output_size = n.get_total_output_params()
130
158
  activation_outputs.append(node_output_size)
159
+ # Calculate activation size in bytes and append to list
160
+ activation_outputs_bytes.append(node_output_size * max_activation_bits / BITS_TO_BYTES)
131
161
 
132
- return np.array(activation_outputs)
162
+ return np.array(activation_outputs_bytes), np.array(activation_outputs)
133
163
 
134
164
 
135
165
  def compute_total_bops(graph: Graph, fw_info: FrameworkInfo, fw_impl: FrameworkImplementation) -> np.ndarray:
@@ -162,3 +192,56 @@ def compute_total_bops(graph: Graph, fw_info: FrameworkInfo, fw_impl: FrameworkI
162
192
  bops.append(node_bops)
163
193
 
164
194
  return np.array(bops)
195
+
196
+
197
+ def requires_mixed_precision(in_model: Any,
198
+ target_resource_utilization: ResourceUtilization,
199
+ representative_data_gen: Callable,
200
+ core_config: CoreConfig,
201
+ tpc: TargetPlatformCapabilities,
202
+ fw_info: FrameworkInfo,
203
+ fw_impl: FrameworkImplementation) -> bool:
204
+ """
205
+ The function checks whether the model requires mixed precision to meet the requested target resource utilization.
206
+ This is determined by whether the target memory usage of the weights is less than the available memory,
207
+ the target maximum size of an activation tensor is less than the available memory,
208
+ and the target number of BOPs is less than the available BOPs.
209
+ If any of these conditions are met, the function returns True. Otherwise, it returns False.
210
+
211
+ Args:
212
+ in_model: The model to be evaluated.
213
+ target_resource_utilization: The resource utilization of the target device.
214
+ representative_data_gen: A function that generates representative data for the model.
215
+ core_config: CoreConfig containing parameters of how the model should be quantized.
216
+ tpc: TargetPlatformCapabilities object that models the inference target platform and
217
+ the attached framework operator's information.
218
+ fw_info: Information needed for quantization about the specific framework.
219
+ fw_impl: FrameworkImplementation object with a specific framework methods implementation.
220
+
221
+ Returns: A boolean indicating if mixed precision is needed.
222
+ """
223
+ is_mixed_precision = False
224
+ transformed_graph = graph_preparation_runner(in_model,
225
+ representative_data_gen,
226
+ core_config.quantization_config,
227
+ fw_info,
228
+ fw_impl,
229
+ tpc,
230
+ mixed_precision_enable=False)
231
+ # Compute max weights memory in bytes
232
+ weights_memory_by_layer_bytes, _ = compute_nodes_weights_params(transformed_graph, fw_info)
233
+ total_weights_memory_bytes = 0 if len(weights_memory_by_layer_bytes) == 0 else sum(weights_memory_by_layer_bytes)
234
+
235
+ # Compute max activation tensor in bytes
236
+ activation_output_sizes_bytes, _ = compute_activation_output_sizes(transformed_graph)
237
+ max_activation_tensor_size_bytes = 0 if len(activation_output_sizes_bytes) == 0 else max(activation_output_sizes_bytes)
238
+
239
+ # Compute BOPS utilization - total count of bit-operations for all configurable layers with kernel
240
+ bops_count = compute_total_bops(graph=transformed_graph, fw_info=fw_info, fw_impl=fw_impl)
241
+ bops_count = np.inf if len(bops_count) == 0 else sum(bops_count)
242
+
243
+ is_mixed_precision |= target_resource_utilization.weights_memory < total_weights_memory_bytes
244
+ is_mixed_precision |= target_resource_utilization.activation_memory < max_activation_tensor_size_bytes
245
+ is_mixed_precision |= target_resource_utilization.total_memory < total_weights_memory_bytes + max_activation_tensor_size_bytes
246
+ is_mixed_precision |= target_resource_utilization.bops < bops_count
247
+ return is_mixed_precision
@@ -73,7 +73,7 @@ class PerChannelMask:
73
73
  mask_indicator: The new value to set in the mask (either PRUNED or REMAINED).
74
74
  """
75
75
  if mask_indicator not in [MaskIndicator.PRUNED, MaskIndicator.REMAINED]:
76
- Logger.critical("Mask value must be either 'MaskIndicator.PRUNED' or 'MaskIndicator.REMAINED'")
76
+ Logger.critical("Mask value must be either 'MaskIndicator.PRUNED' or 'MaskIndicator.REMAINED'") # pragma: no cover
77
77
  self._mask[node][channel_idx] = mask_indicator.value
78
78
 
79
79
  def has_pruned_channel(self) -> bool:
@@ -79,7 +79,7 @@ class PerSIMDGroupMask:
79
79
  mask_indicator: The new value to set in the mask (either PRUNED or REMAINED).
80
80
  """
81
81
  if mask_indicator not in [MaskIndicator.PRUNED, MaskIndicator.REMAINED]:
82
- Logger.critical("Mask value must be either 'MaskIndicator.PRUNED' or 'MaskIndicator.REMAINED'")
82
+ Logger.critical("Mask value must be either 'MaskIndicator.PRUNED' or 'MaskIndicator.REMAINED'") # pragma: no cover
83
83
 
84
84
  # Update the SIMD group mask and corresponding per-channel mask
85
85
  self._mask_simd[node][group_index] = mask_indicator.value
@@ -92,7 +92,7 @@ class Pruner:
92
92
  mask_calculator.compute_mask()
93
93
  self.per_oc_mask = mask_calculator.get_mask()
94
94
  else:
95
- Logger.critical("Only GREEDY ChannelsFilteringStrategy is currently supported.")
95
+ Logger.critical("Only GREEDY ChannelsFilteringStrategy is currently supported.") # pragma: no cover
96
96
 
97
97
  Logger.info("Start pruning graph...")
98
98
  _pruned_graph = build_pruned_graph(self.float_graph,
@@ -76,7 +76,7 @@ def unroll_simd_scores_to_per_channel_scores(simd_scores: Dict[BaseNode, np.ndar
76
76
  """
77
77
  if simd_scores is None or simd_groups_indices is None:
78
78
  Logger.critical(f"Failed to find scores and indices to create unrolled scores for pruning information."
79
- f" Scores: {simd_scores}, Group indices: {simd_groups_indices}.")
79
+ f" Scores: {simd_scores}, Group indices: {simd_groups_indices}.") # pragma: no cover
80
80
  _scores = {}
81
81
  for node, groups_indices in simd_groups_indices.items():
82
82
  node_scores = simd_scores[node]
@@ -65,10 +65,8 @@ class BaseNodeQuantizationConfig(object):
65
65
  """
66
66
  Returns: String to display a NodeQuantizationConfig object.
67
67
  """
68
- repr_str = ''
69
- for k, v in self.__dict__.items():
70
- repr_str += f'{k}: {v}\n'
71
- return repr_str
68
+ # Used for debugging, thus no cover.
69
+ return ''.join(f'{k}: {v}\n' for k, v in self.__dict__.items()) # pragma: no cover
72
70
 
73
71
 
74
72
  class NodeActivationQuantizationConfig(BaseNodeQuantizationConfig):
@@ -124,7 +124,8 @@ class QuantizationConfig:
124
124
  self.concat_threshold_update = concat_threshold_update
125
125
 
126
126
  def __repr__(self):
127
- return str(self.__dict__)
127
+ # Used for debugging, thus no cover.
128
+ return str(self.__dict__) # pragma: no cover
128
129
 
129
130
 
130
131
  # Default quantization configuration the library use.
@@ -44,6 +44,6 @@ def get_weights_quantization_fn(weights_quantization_method: QuantizationMethod)
44
44
  quantizer_fn = lut_kmeans_quantizer
45
45
  else:
46
46
  Logger.critical(
47
- f"No quantizer function found for the specified quantization method: {weights_quantization_method}")
47
+ f"No quantizer function found for the specified quantization method: {weights_quantization_method}") # pragma: no cover
48
48
 
49
49
  return quantizer_fn
@@ -15,6 +15,7 @@
15
15
 
16
16
  from model_compression_toolkit.core.common.graph.base_graph import Graph, OutTensor
17
17
  from model_compression_toolkit.core.common.graph.base_node import BaseNode
18
+ from model_compression_toolkit.logger import Logger
18
19
 
19
20
 
20
21
  def remove_identity_node(graph: Graph,
@@ -36,7 +37,9 @@ def remove_identity_node(graph: Graph,
36
37
 
37
38
  # Ensure there is exactly one predecessor; otherwise, do nothing.
38
39
  if len(prev_identity_nodes) != 1:
39
- return graph
40
+ # We do not expect to get here.
41
+ Logger.error(f"Identity node {node} have {len(prev_identity_nodes)} inputs, while expected to have one. Skipping remove identity substitution.") # pragma: no cover
42
+ return graph # pragma: no cover
40
43
 
41
44
  graph_outputs = graph.get_outputs()
42
45
  for i, g_out in enumerate(graph_outputs):
@@ -25,9 +25,9 @@ if version.parse(tf.__version__) >= version.parse("2.13"):
25
25
  from keras.src.layers.core import TFOpLambda
26
26
  from keras.src.engine.base_layer import TensorFlowOpLayer, Layer
27
27
  else:
28
- from keras import Input
29
- from keras.layers.core import TFOpLambda
30
- from keras.engine.base_layer import TensorFlowOpLayer, Layer
28
+ from keras import Input # pragma: no cover
29
+ from keras.layers.core import TFOpLambda # pragma: no cover
30
+ from keras.engine.base_layer import TensorFlowOpLayer, Layer # pragma: no cover
31
31
 
32
32
  from typing import Any, Dict, List, Tuple, Callable
33
33
  from tensorflow.python.util.object_identity import Reference as TFReference
@@ -19,7 +19,7 @@ import tensorflow as tf
19
19
  if version.parse(tf.__version__) >= version.parse("2.13"):
20
20
  from keras.src.engine.base_layer import Layer
21
21
  else:
22
- from keras.engine.base_layer import Layer
22
+ from keras.engine.base_layer import Layer # pragma: no cover
23
23
 
24
24
  from keras.models import Model
25
25
  from mct_quantizers import KerasQuantizationWrapper, KerasActivationQuantizationHolder, QuantizationTarget
@@ -22,7 +22,7 @@ from packaging import version
22
22
  if version.parse(tf.__version__) >= version.parse("2.13"):
23
23
  from keras.src.layers import Conv2D, DepthwiseConv2D, Dense, Conv2DTranspose, Softmax, ELU
24
24
  else:
25
- from keras.layers import Conv2D, DepthwiseConv2D, Dense, Conv2DTranspose, Softmax, ELU
25
+ from keras.layers import Conv2D, DepthwiseConv2D, Dense, Conv2DTranspose, Softmax, ELU # pragma: no cover
26
26
 
27
27
  from model_compression_toolkit.defaultdict import DefaultDict
28
28
  from model_compression_toolkit.core.common.framework_info import FrameworkInfo
@@ -66,7 +66,7 @@ class ActivationDecomposition(common.BaseSubstitution):
66
66
  if ACTIVATION not in op2d_node.framework_attr:
67
67
  Logger.warning(f'Op2d node {op2d_node.name} of type {op2d_node.type} is missing an "{ACTIVATION}"'
68
68
  f' attribute -> Skipping substitution ActivationDecomposition') # pragma: no cover
69
- return graph
69
+ return graph # pragma: no cover
70
70
 
71
71
  activation_node_name = op2d_node.name + '_post_activation'
72
72
 
@@ -104,7 +104,7 @@ def conv2d_collapsing_fn(first_node: BaseNode,
104
104
 
105
105
  return kernel_collapsed, bias_collapsed
106
106
  else:
107
- Logger.critical(f"Layer collapsing unsupported for combination: {first_node.type} and {second_node.type}.")
107
+ Logger.critical(f"Layer collapsing unsupported for combination: {first_node.type} and {second_node.type}.") # pragma: no cover
108
108
 
109
109
 
110
110
  def keras_linear_collapsing() -> Conv2DCollapsing:
@@ -62,7 +62,7 @@ def residual_collapsing_fn(first_node: BaseNode,
62
62
 
63
63
  return kernel
64
64
  else:
65
- Logger.critical(f"Residual collapsing is unsupported for {first_node.type} node types.")
65
+ Logger.critical(f"Residual collapsing is unsupported for {first_node.type} node types.") # pragma: no cover
66
66
 
67
67
 
68
68
  def keras_residual_collapsing() -> ResidualCollapsing:
@@ -22,7 +22,7 @@ import tensorflow as tf
22
22
  from tensorflow.python.keras.layers.core import TFOpLambda
23
23
  if version.parse(tf.__version__) >= version.parse("2.13"):
24
24
  from keras.src.layers import Activation, Conv2D, Dense, DepthwiseConv2D, ZeroPadding2D, Reshape, \
25
- GlobalAveragePooling2D, Dropout, ReLU, PReLU, ELU
25
+ GlobalAveragePooling2D, Dropout, ReLU, PReLU, ELU # pragma: no cover
26
26
  else:
27
27
  from tensorflow.keras.layers import Activation, Conv2D, Dense, DepthwiseConv2D, ZeroPadding2D, Reshape, \
28
28
  GlobalAveragePooling2D, Dropout, ReLU, PReLU, ELU
@@ -74,6 +74,6 @@ class TraceHessianCalculatorKeras(TraceHessianCalculator):
74
74
  concat_axis_dim = [o.shape[0] for o in _r_tensors]
75
75
  if not all(d == concat_axis_dim[0] for d in concat_axis_dim):
76
76
  Logger.critical(
77
- "Unable to concatenate tensors for gradient calculation due to mismatched shapes along the first axis.")# pragma: no cover
77
+ "Unable to concatenate tensors for gradient calculation due to mismatched shapes along the first axis.") # pragma: no cover
78
78
 
79
79
  return tf.concat(_r_tensors, axis=1)
@@ -51,13 +51,11 @@ from model_compression_toolkit.core.keras.statistics_correction.apply_second_mom
51
51
  from packaging import version
52
52
 
53
53
  if version.parse(tf.__version__) >= version.parse("2.13"):
54
- from keras.src.layers import Dense, Activation, Conv2D, DepthwiseConv2D, Conv2DTranspose, \
55
- Concatenate, Add
54
+ from keras.src.layers import Dense, Activation, Conv2D, DepthwiseConv2D, Conv2DTranspose, Concatenate, Add
56
55
  from keras.src.layers.core import TFOpLambda
57
56
  else:
58
- from keras.layers import Dense, Activation, Conv2D, DepthwiseConv2D, Conv2DTranspose, \
59
- Concatenate, Add
60
- from keras.layers.core import TFOpLambda
57
+ from keras.layers import Dense, Activation, Conv2D, DepthwiseConv2D, Conv2DTranspose, Concatenate, Add # pragma: no cover
58
+ from keras.layers.core import TFOpLambda # pragma: no cover
61
59
 
62
60
  from model_compression_toolkit.core import QuantizationConfig, FrameworkInfo, CoreConfig, MixedPrecisionQuantizationConfig
63
61
  from model_compression_toolkit.core import common
@@ -489,7 +487,7 @@ class KerasImplementation(FrameworkImplementation):
489
487
  fw_impl=self,
490
488
  num_iterations_for_approximation=num_iterations_for_approximation)
491
489
  else:
492
- Logger.critical(f"Unsupported Hessian mode for Keras: {trace_hessian_request.mode}.")
490
+ Logger.critical(f"Unsupported Hessian mode for Keras: {trace_hessian_request.mode}.") # pragma: no cover
493
491
 
494
492
  def is_output_node_compatible_for_hessian_score_computation(self,
495
493
  node: BaseNode) -> Any:
@@ -6,7 +6,7 @@ from packaging import version
6
6
  if version.parse(tf.__version__) >= version.parse("2.13"):
7
7
  from keras.src.layers import Activation, ReLU, BatchNormalization
8
8
  else:
9
- from keras.layers import Activation, ReLU, BatchNormalization
9
+ from keras.layers import Activation, ReLU, BatchNormalization # pragma: no cover
10
10
 
11
11
  from model_compression_toolkit.core import FrameworkInfo
12
12
  from model_compression_toolkit.core.common import BaseNode
@@ -24,6 +24,17 @@ from model_compression_toolkit.logger import Logger
24
24
  from model_compression_toolkit.constants import THRESHOLD, SIGNED, RANGE_MIN, RANGE_MAX
25
25
  from model_compression_toolkit.core.common.quantization.quantizers.uniform_quantizers import threshold_is_power_of_two
26
26
 
27
+ ################################################################
28
+ ################################################################
29
+ # TODO:
30
+ # These quantizer functions are for internal use. They are currently
31
+ # used in some features like MP for activation and SNC (where
32
+ # inference in the framework is needed).
33
+ # It may worth considering removing these functions and use
34
+ # activation inferable quantizers in those features like we do
35
+ # in GPTQ.
36
+ ################################################################
37
+ ################################################################
27
38
 
28
39
  def quantizer_min_max_calculator(threshold: np.ndarray,
29
40
  num_bits: int,
@@ -24,10 +24,10 @@ if version.parse(tf.__version__) >= version.parse("2.13"):
24
24
  from keras.src.engine.functional import Functional
25
25
  from keras.src.engine.sequential import Sequential
26
26
  else:
27
- from keras.engine.input_layer import InputLayer
28
- from keras.engine.node import Node as KerasNode
29
- from keras.engine.functional import Functional
30
- from keras.engine.sequential import Sequential
27
+ from keras.engine.input_layer import InputLayer # pragma: no cover
28
+ from keras.engine.node import Node as KerasNode # pragma: no cover
29
+ from keras.engine.functional import Functional # pragma: no cover
30
+ from keras.engine.sequential import Sequential # pragma: no cover
31
31
 
32
32
  from model_compression_toolkit.logger import Logger
33
33
  from model_compression_toolkit.core.common.graph.base_node import BaseNode
@@ -38,18 +38,3 @@ def node_builder(n: BaseNode) -> Module:
38
38
  return node_instance
39
39
 
40
40
 
41
- # todo: remove. It is not used anymore
42
- def identity_wrapper(node: BaseNode,
43
- module: Module,
44
- include_activation_quantizers: bool):
45
- """
46
- A function which takes a computational graph node and a pytorch module and return an identity wrapping which return the layer itself
47
- Args:
48
- node: A node of mct graph.
49
- layer: A pytorch module
50
- include_activation_quantizers: bool flag.
51
- Returns: pytorch module
52
- """
53
- return module
54
-
55
-
@@ -27,7 +27,7 @@ from model_compression_toolkit.core.common.back2framework.base_model_builder imp
27
27
  from model_compression_toolkit.core.common.graph.edge import EDGE_SINK_INDEX
28
28
  from model_compression_toolkit.core.common.graph.functional_node import FunctionalNode
29
29
  from model_compression_toolkit.core.common.user_info import UserInformation
30
- from model_compression_toolkit.core.pytorch.back2framework.instance_builder import node_builder, identity_wrapper
30
+ from model_compression_toolkit.core.pytorch.back2framework.instance_builder import node_builder
31
31
  from model_compression_toolkit.core.pytorch.default_framework_info import DEFAULT_PYTORCH_INFO
32
32
  from model_compression_toolkit.core.pytorch.pytorch_device_config import get_working_device
33
33
  from model_compression_toolkit.core.pytorch.reader.node_holders import DummyPlaceHolder
@@ -101,7 +101,7 @@ def conv2d_collapsing_fn(first_node: BaseNode,
101
101
 
102
102
  return kernel_collapsed, bias_collapsed
103
103
  else:
104
- Logger.critical(f"Layer collapsing is not supported for the combination of {first_node.type} and {second_node.type}.")
104
+ Logger.critical(f"Layer collapsing is not supported for the combination of {first_node.type} and {second_node.type}.") # pragma: no cover
105
105
 
106
106
 
107
107
  def pytorch_linear_collapsing() -> Conv2DCollapsing:
@@ -58,7 +58,7 @@ def residual_collapsing_fn(first_node: BaseNode,
58
58
  kernel[i, i, idxH, idxW] += 1
59
59
  return kernel
60
60
  else:
61
- Logger.critical(f"Residual collapsing not supported for node type: {first_node.type}")
61
+ Logger.critical(f"Residual collapsing not supported for node type: {first_node.type}") # pragma: no cover
62
62
 
63
63
 
64
64
  def pytorch_residual_collapsing() -> ResidualCollapsing:
@@ -65,6 +65,6 @@ class TraceHessianCalculatorPytorch(TraceHessianCalculator):
65
65
  concat_axis_dim = [o.shape[0] for o in _r_tensors]
66
66
  if not all(d == concat_axis_dim[0] for d in concat_axis_dim):
67
67
  Logger.critical(
68
- "Unable to concatenate tensors for gradient calculation due to mismatched shapes along the first axis.")
68
+ "Unable to concatenate tensors for gradient calculation due to mismatched shapes along the first axis.") # pragma: no cover
69
69
 
70
70
  return torch.concat(_r_tensors, dim=1)
@@ -87,13 +87,16 @@ class DeviceManager:
87
87
  device_index = int(device_name.split(':')[1])
88
88
  if device_index >= torch.cuda.device_count():
89
89
  return False, f"CUDA device index {device_index} out of range. Number of valid devices: {torch.cuda.device_count()}"
90
- except IndexError:
90
+ except Exception:
91
91
  # Handle cases where the device name is incorrectly formatted
92
92
  return False, "Invalid CUDA device format. Use 'cuda' or 'cuda:x' where x is the device index."
93
93
 
94
94
  return True, "Valid device"
95
95
 
96
- return True, "Valid device"
96
+ if CPU in device_name:
97
+ return True, "Valid device"
98
+
99
+ return False, "Invalid device"
97
100
 
98
101
 
99
102
 
@@ -20,6 +20,18 @@ from model_compression_toolkit.core.common.quantization.quantizers.uniform_quant
20
20
  from model_compression_toolkit.core.common.quantization.quantizers.quantizers_helpers import fix_range_to_include_zero
21
21
 
22
22
 
23
+ ################################################################
24
+ ################################################################
25
+ # TODO:
26
+ # These quantizer functions are for internal use. They are currently
27
+ # used in some features like MP for activation and SNC (where
28
+ # inference in the framework is needed).
29
+ # It may worth considering removing these functions and use
30
+ # activation inferable quantizers in those features like we do
31
+ # in GPTQ.
32
+ ################################################################
33
+ ################################################################
34
+
23
35
  def get_symmetric_quantization_range_and_scale(activation_is_signed: bool,
24
36
  activation_n_bits: int,
25
37
  activation_threshold: float):
@@ -20,6 +20,8 @@ import numpy as np
20
20
 
21
21
  from model_compression_toolkit.core.common import FrameworkInfo
22
22
  from model_compression_toolkit.core.common.hessian.hessian_info_service import HessianInfoService
23
+ from model_compression_toolkit.core.common.mixed_precision.resource_utilization_tools.resource_utilization_data import \
24
+ requires_mixed_precision
23
25
  from model_compression_toolkit.core.graph_prep_runner import graph_preparation_runner
24
26
  from model_compression_toolkit.core.quantization_prep_runner import quantization_preparation_runner
25
27
  from model_compression_toolkit.logger import Logger
@@ -89,7 +91,16 @@ def core_runner(in_model: Any,
89
91
  if core_config.mixed_precision_config is None:
90
92
  Logger.critical("Provided an initialized target_resource_utilization, that means that mixed precision quantization is "
91
93
  "enabled, but the provided MixedPrecisionQuantizationConfig is None.")
92
- core_config.mixed_precision_config.set_mixed_precision_enable()
94
+ # Determine whether to use mixed precision or single precision based on target_resource_utilization.
95
+ if requires_mixed_precision(in_model,
96
+ target_resource_utilization,
97
+ representative_data_gen,
98
+ core_config,
99
+ tpc,
100
+ fw_info,
101
+ fw_impl):
102
+ core_config.mixed_precision_config.set_mixed_precision_enable()
103
+ Logger.info('Mixed precision enabled.')
93
104
 
94
105
  graph = graph_preparation_runner(in_model,
95
106
  representative_data_gen,
@@ -35,8 +35,7 @@ class OriginalBNStatsHolder:
35
35
  """
36
36
  self.bn_params = self.get_bn_params(model, bn_layer_types)
37
37
  if self.get_num_bn_layers() == 0:
38
- Logger.critical(
39
- f'Data generation requires a model with at least one BatchNorm layer.')
38
+ Logger.critical(f'Data generation requires a model with at least one BatchNorm layer.')
40
39
 
41
40
  def get_bn_layer_names(self) -> List[str]:
42
41
  """
@@ -105,7 +104,7 @@ class OriginalBNStatsHolder:
105
104
  Returns:
106
105
  dict: Dictionary mapping batch normalization layer names to their parameters.
107
106
  """
108
- raise NotImplemented
107
+ raise NotImplemented # pragma: no cover
109
108
 
110
109
 
111
110
  class ActivationExtractor:
@@ -123,7 +122,7 @@ class ActivationExtractor:
123
122
  model (Any): The model.
124
123
  layer_types_to_extract_inputs (List): Tuple or list of layer types.
125
124
  """
126
- raise NotImplemented
125
+ raise NotImplemented # pragma: no cover
127
126
 
128
127
  @abstractmethod
129
128
  def get_layer_input_activation(self, layer_name: str) -> Any:
@@ -136,7 +135,7 @@ class ActivationExtractor:
136
135
  Returns:
137
136
  Any: Input activation tensor of the layer.
138
137
  """
139
- raise NotImplemented
138
+ raise NotImplemented # pragma: no cover
140
139
 
141
140
  @abstractmethod
142
141
  def get_output_layer_input_activation(self) -> List:
@@ -146,7 +145,7 @@ class ActivationExtractor:
146
145
  Returns:
147
146
  Any: Input activation tensors of all the output layers that are Linear or Conv2d.
148
147
  """
149
- raise NotImplemented
148
+ raise NotImplemented # pragma: no cover
150
149
 
151
150
  @abstractmethod
152
151
  def get_last_linear_layers_weights(self) -> List:
@@ -156,7 +155,7 @@ class ActivationExtractor:
156
155
  Returns:
157
156
  List: Weight tensors of all the last linear layers.
158
157
  """
159
- raise NotImplemented
158
+ raise NotImplemented # pragma: no cover
160
159
 
161
160
  def get_num_extractor_layers(self) -> int:
162
161
  """
@@ -175,21 +174,21 @@ class ActivationExtractor:
175
174
  Returns:
176
175
  List: A list of layer names for which to extract input activations.
177
176
  """
178
- raise NotImplemented
177
+ raise NotImplemented # pragma: no cover
179
178
 
180
179
  @abstractmethod
181
180
  def clear(self):
182
181
  """
183
182
  Clear the stored activation tensors.
184
183
  """
185
- raise NotImplemented
184
+ raise NotImplemented # pragma: no cover
186
185
 
187
186
  @abstractmethod
188
187
  def remove(self):
189
188
  """
190
189
  Remove the hooks from the model.
191
190
  """
192
- raise NotImplemented
191
+ raise NotImplemented # pragma: no cover
193
192
 
194
193
  @abstractmethod
195
194
  def run_model(self, inputs: Any) -> Any:
@@ -202,4 +201,4 @@ class ActivationExtractor:
202
201
  Returns:
203
202
  Any: Output tensor.
204
203
  """
205
- raise NotImplemented
204
+ raise NotImplemented # pragma: no cover
@@ -159,7 +159,7 @@ class ImagesOptimizationHandler:
159
159
  Returns:
160
160
  Tuple[Any, Any]: the averaged activation statistics on all the batches for the specified layer.
161
161
  """
162
- raise NotImplemented
162
+ raise NotImplemented # pragma: no cover
163
163
 
164
164
  def compute_bn_loss(self,
165
165
  input_imgs: Any,
@@ -245,7 +245,7 @@ class ImagesOptimizationHandler:
245
245
  loss (Any): The loss value.
246
246
  i_ter (int): The current iteration.
247
247
  """
248
- raise NotImplemented
248
+ raise NotImplemented # pragma: no cover
249
249
 
250
250
  @abstractmethod
251
251
  def zero_grad(self, batch_index: int):
@@ -255,7 +255,7 @@ class ImagesOptimizationHandler:
255
255
  Args:
256
256
  batch_index (int): Index of the batch.
257
257
  """
258
- raise NotImplemented
258
+ raise NotImplemented # pragma: no cover
259
259
 
260
260
  @abstractmethod
261
261
  def get_finalized_images(self) -> list:
@@ -265,7 +265,7 @@ class ImagesOptimizationHandler:
265
265
  Returns:
266
266
  list: a list of the generated images.
267
267
  """
268
- raise NotImplemented
268
+ raise NotImplemented # pragma: no cover
269
269
 
270
270
 
271
271
  class BatchOptimizationHolder:
@@ -291,7 +291,7 @@ class BatchOptimizationHolder:
291
291
  scheduler (Any): scheduler responsible for adjusting the learning rate of the optimizer over time.
292
292
  initial_lr (float): the initial learning rate used by the optimizer.
293
293
  """
294
- raise NotImplemented
294
+ raise NotImplemented # pragma: no cover
295
295
 
296
296
  def get_images(self) -> Any:
297
297
  """Returns the stored images"""
@@ -344,7 +344,7 @@ class AllImagesStatsHolder:
344
344
  Returns:
345
345
  list: List of batches stats holders.
346
346
  """
347
- raise NotImplemented
347
+ raise NotImplemented # pragma: no cover
348
348
 
349
349
  def update_batch_stats(self,
350
350
  batch_index: int,
@@ -442,7 +442,7 @@ class BatchStatsHolder:
442
442
  Returns:
443
443
  Any: the variance for the specified layer.
444
444
  """
445
- raise NotImplemented
445
+ raise NotImplemented # pragma: no cover
446
446
 
447
447
  def get_std(self, bn_layer_name: str) -> Any:
448
448
  """
@@ -454,7 +454,7 @@ class BatchStatsHolder:
454
454
  Returns:
455
455
  Any: the variance for the specified layer.
456
456
  """
457
- raise NotImplemented
457
+ raise NotImplemented # pragma: no cover
458
458
 
459
459
  def update_layer_stats(self,
460
460
  bn_layer_name: str,
@@ -483,7 +483,7 @@ class BatchStatsHolder:
483
483
  activation_extractor (ActivationExtractor): the activation extractor object.
484
484
  to_differentiate (bool): a flag indicating whether to differentiate or not.
485
485
  """
486
- raise NotImplemented
486
+ raise NotImplemented # pragma: no cover
487
487
 
488
488
  def clear(self):
489
489
  """Clear the statistics."""
@@ -76,7 +76,7 @@ class GPTQTrainer(ABC):
76
76
  if self.gptq_config.use_hessian_based_weights:
77
77
  if not isinstance(hessian_info_service, HessianInfoService):
78
78
  Logger.critical(f"When using Hessian-based approximations for sensitivity evaluation, "
79
- f"an 'HessianInfoService' object must be provided, but received: {hessian_info_service}.")
79
+ f"an 'HessianInfoService' object must be provided, but received: {hessian_info_service}.") # pragma: no cover
80
80
  self.hessian_service = hessian_info_service
81
81
 
82
82
  def get_optimizer_with_param(self,
@@ -238,47 +238,12 @@ class GPTQTrainer(ABC):
238
238
  trace_approx: Trace approximation to validate.
239
239
  """
240
240
  if not isinstance(trace_approx, list):
241
- Logger.critical(f"Trace approximation was expected to be a list but is of type: {type(trace_approx)}.")
241
+ Logger.critical(f"Trace approximation was expected to be a list but is of type: {type(trace_approx)}.") # pragma: no cover
242
242
  if len(trace_approx) != 1:
243
243
  Logger.critical(f"Trace approximation was expected to have a length of 1 "
244
244
  f"(for computations with granularity set to 'HessianInfoGranularity.PER_TENSOR') "
245
245
  f"but has a length of {len(trace_approx)}."
246
- )
247
-
248
- @staticmethod
249
- def _generate_images_batch(representative_data_gen: Callable, num_samples_for_loss: int) -> np.ndarray:
250
- """
251
- Construct batches of image samples for inference.
252
-
253
- Args:
254
- representative_data_gen: A callable method to retrieve images from Dataset.
255
- num_samples_for_loss: Num of total images for evaluation.
256
-
257
- Returns: A tensor of images batches
258
- """
259
- # First, select images to use for all measurements.
260
- samples_count = 0 # Number of images we used so far to compute the distance matrix.
261
- images = []
262
- for inference_batch_input in representative_data_gen():
263
- if samples_count >= num_samples_for_loss:
264
- break
265
- num_images = inference_batch_input[0].shape[0]
266
-
267
- # If we sampled more images than we should,
268
- # we take only a subset of these images and use only them.
269
- if num_images > num_samples_for_loss - samples_count:
270
- inference_batch_input = [x[:num_samples_for_loss - samples_count] for x in inference_batch_input]
271
- assert num_samples_for_loss - samples_count == inference_batch_input[0].shape[0]
272
- num_images = num_samples_for_loss - samples_count
273
-
274
- images.append(inference_batch_input[0])
275
- samples_count += num_images
276
- else:
277
- if samples_count < num_samples_for_loss:
278
- Logger.warning(f'Not enough images in representative dataset to generate {num_samples_for_loss} data points, '
279
- f'only {samples_count} were generated')
280
-
281
- return np.concatenate(images, axis=0)
246
+ ) # pragma: no cover
282
247
 
283
248
 
284
249
  @abstractmethod
@@ -82,9 +82,6 @@ if FOUND_TF:
82
82
 
83
83
  else:
84
84
  class BaseKerasTrainableQuantizer(BaseTrainableQuantizer):
85
- def __init__(self,
86
- quantization_config: Union[TrainableQuantizerWeightsConfig, TrainableQuantizerActivationConfig]):
87
-
88
- super().__init__(quantization_config)
85
+ def __init__(self, *args, **kwargs):
89
86
  Logger.critical("Tensorflow must be installed to use BaseKerasTrainableQuantizer. "
90
87
  "The 'tensorflow' package is missing.") # pragma: no cover
@@ -57,9 +57,7 @@ if FOUND_TORCH:
57
57
 
58
58
  else:
59
59
  class BasePytorchTrainableQuantizer(BaseTrainableQuantizer):
60
- def __init__(self,
61
- quantization_config: Union[TrainableQuantizerWeightsConfig, TrainableQuantizerActivationConfig]):
62
- super().__init__(quantization_config)
60
+ def __init__(self, *args, **kwargs):
63
61
  Logger.critical("PyTorch must be installed to use 'BasePytorchTrainableQuantizer'. "
64
62
  "The 'torch' package is missing.") # pragma: no cover
65
63