mct-nightly 2.4.0.20250707.643__py3-none-any.whl → 2.4.0.20250708.612__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mct-nightly
3
- Version: 2.4.0.20250707.643
3
+ Version: 2.4.0.20250708.612
4
4
  Summary: A Model Compression Toolkit for neural networks
5
5
  Author-email: ssi-dnn-dev@sony.com
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,5 +1,5 @@
1
- mct_nightly-2.4.0.20250707.643.dist-info/licenses/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
2
- model_compression_toolkit/__init__.py,sha256=n67zJIaNzqdkUrpJl9e_iXZ7xM4vgLz7U7d06AHkmTU,1557
1
+ mct_nightly-2.4.0.20250708.612.dist-info/licenses/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
2
+ model_compression_toolkit/__init__.py,sha256=TrwEn4n4YKNNqTg96Ud45uv2qh_Ob-Q1IzRMrsqjJG4,1557
3
3
  model_compression_toolkit/constants.py,sha256=KNgiNLpsMgSYyXMNEbHXd4bFNerQc1D6HH3vpbUq_Gs,4086
4
4
  model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
5
5
  model_compression_toolkit/logger.py,sha256=L3q7tn3Uht0i_7phnlOWMR2Te2zvzrt2HOz9vYEInts,4529
@@ -16,7 +16,7 @@ model_compression_toolkit/core/common/framework_implementation.py,sha256=jrTupZb
16
16
  model_compression_toolkit/core/common/framework_info.py,sha256=vPGV28gm-kvNSkkWI6jY3YeKBUYmn6UQ98HVUnl_-tM,5449
17
17
  model_compression_toolkit/core/common/memory_computation.py,sha256=ixoSpV5ZYZGyzhre3kQcvR2sNA8KBsPZ3lgbkDnw9Cs,1205
18
18
  model_compression_toolkit/core/common/model_builder_mode.py,sha256=jll9-59OPaE3ug7Y9-lLyV99_FoNHxkGZMgcm0Vkpss,1324
19
- model_compression_toolkit/core/common/model_collector.py,sha256=fgSLqbi1YRyvISJIP9WyZv3IlvuMplywJ-ffUnDWN1Q,13655
19
+ model_compression_toolkit/core/common/model_collector.py,sha256=I0O5SoUrwB045AGLleOGYVvZyR7HJx_t6vfbECahfoU,13914
20
20
  model_compression_toolkit/core/common/node_prior_info.py,sha256=WXX_PrGVG9M9I_REG5ZzFBohwmV4yf356sZnrja_FLo,2832
21
21
  model_compression_toolkit/core/common/similarity_analyzer.py,sha256=S3f6WgHyw62dGcxpX51FGKyfebe2zv9ABKbjtGyKRvY,9215
22
22
  model_compression_toolkit/core/common/user_info.py,sha256=dSRMnT-oewmdOziIpEuW-s9K7vTSeyUBxT4z9neXurI,1648
@@ -106,7 +106,7 @@ model_compression_toolkit/core/common/quantization/candidate_node_quantization_c
106
106
  model_compression_toolkit/core/common/quantization/core_config.py,sha256=yxCzWqldcHoe8GGxrH0tp99bhrc5jDT7SgZftnMUUBE,2374
107
107
  model_compression_toolkit/core/common/quantization/debug_config.py,sha256=uH45Uq3Tp9FIyMynex_WY2_y-Kv8LuPw2XXZydnpW5A,1649
108
108
  model_compression_toolkit/core/common/quantization/filter_nodes_candidates.py,sha256=FyYCYbfkAofEWO2mAvFIppPeq2I10f1ScPNiVa9F7x4,7687
109
- model_compression_toolkit/core/common/quantization/node_quantization_config.py,sha256=te18Lv-pwAbING6CnURANZZVeThFn3tDmNBBSXwBcuM,21306
109
+ model_compression_toolkit/core/common/quantization/node_quantization_config.py,sha256=VRY_HxZl9D77eq6oJ61eBnL4QJTG5pVLzJtAcaZATRQ,21636
110
110
  model_compression_toolkit/core/common/quantization/quantization_config.py,sha256=EMhXeY1qkvwlMAY5fpKRDuLEAyRY5yKqe2fOmAD_rVI,4362
111
111
  model_compression_toolkit/core/common/quantization/quantization_fn_selection.py,sha256=VVq2cKjumlNWucUbaNw8s2J0IbI_vrQ-KR_eQPshGSg,3140
112
112
  model_compression_toolkit/core/common/quantization/quantize_graph_weights.py,sha256=N005MSvx8UypVpa7XrxNrB2G732n2wHj3RmLyjTgd3I,2728
@@ -117,8 +117,8 @@ model_compression_toolkit/core/common/quantization/quantization_params_generatio
117
117
  model_compression_toolkit/core/common/quantization/quantization_params_generation/lut_kmeans_params.py,sha256=RL-PklAjGyC-26anSt8fU07a6pB_LBQFQy9o4e9giN0,8739
118
118
  model_compression_toolkit/core/common/quantization/quantization_params_generation/outlier_filter.py,sha256=9gnfJV89jpGwAx8ImJ5E9NjCv3lDtbyulP4OtgWb62M,1772
119
119
  model_compression_toolkit/core/common/quantization/quantization_params_generation/power_of_two_selection.py,sha256=-cghHF5S11qbjTDRruHlc__uaDoofZHl7QTl8hCeKW0,11141
120
- model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_activations_computation.py,sha256=KoPYo6il5Pa5Y54KUa1GiB5G_hGzN8yMTgLOsC6QElY,7650
121
- model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_computation.py,sha256=bsVCs5KrVKtagHG4VLFzxN2f-YKs0-mhV9VmL57SE9E,7924
120
+ model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_activations_computation.py,sha256=vOFquQ3_h0jyG8EEeHM8M57uIKMZQ7iobUgbvWbiXh4,7798
121
+ model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_computation.py,sha256=TPSkKujdJ6jB7VOVp0kRgMnthmeuaBZgN1HQuJ2pqR0,7951
122
122
  model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_search.py,sha256=Nv_b3DECVjQnlrUet2kbuSvSKVnxcc-gf2zhFb2jSZk,43482
123
123
  model_compression_toolkit/core/common/quantization/quantization_params_generation/qparams_weights_computation.py,sha256=saOQMtj1qYqgQoAFjq31p7xtiRDxmanGGdm0DE81_cg,4820
124
124
  model_compression_toolkit/core/common/quantization/quantization_params_generation/symmetric_selection.py,sha256=6tRNgWvn-4r8hiSHqND7Qms1Nje1DUR4MR0JeWCNyvI,12531
@@ -530,7 +530,7 @@ model_compression_toolkit/xquant/pytorch/model_analyzer.py,sha256=b93o800yVB3Z-i
530
530
  model_compression_toolkit/xquant/pytorch/pytorch_report_utils.py,sha256=Y0oBl8qPFsdNrK49XczwmVacInJcOPHslVnFBs-iTCc,3742
531
531
  model_compression_toolkit/xquant/pytorch/similarity_functions.py,sha256=CERxq5K8rqaiE-DlwhZBTUd9x69dtYJlkHOPLB54vm8,2354
532
532
  model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=n0HvWBzkBkUJZlS3WeynhpsRTps2qQkjlq7luliBHNU,9627
533
- mct_nightly-2.4.0.20250707.643.dist-info/METADATA,sha256=ZQC6URpJO-t-tH6PFUmNg-09N-hh6EnJg-P8ykkesoA,25555
534
- mct_nightly-2.4.0.20250707.643.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
535
- mct_nightly-2.4.0.20250707.643.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
536
- mct_nightly-2.4.0.20250707.643.dist-info/RECORD,,
533
+ mct_nightly-2.4.0.20250708.612.dist-info/METADATA,sha256=DXcxuSC6OdHkGc28g74YdpfdWU7tRPQY-SPtmkfmJvw,25555
534
+ mct_nightly-2.4.0.20250708.612.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
535
+ mct_nightly-2.4.0.20250708.612.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
536
+ mct_nightly-2.4.0.20250708.612.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.4.0.20250707.000643"
30
+ __version__ = "2.4.0.20250708.000612"
@@ -57,19 +57,21 @@ def create_stats_collector_for_node(node: common.BaseNode,
57
57
 
58
58
 
59
59
  def create_tensor2node(graph: common.Graph,
60
- node: common.BaseNode):
60
+ node: common.BaseNode,
61
+ next_node_output_channel_axis: int):
61
62
  """
62
63
  Force statistic collector creation and assignment for a node.
63
64
  Args:
64
65
  graph: Graph of the node (for retrieving the current tensor).
65
66
  node: Node to create a tensor for.
67
+ next_node_output_channel_axis: channel output axis of next node.
66
68
 
67
69
  """
68
70
  current_sc = graph.get_out_stats_collector(node)
69
71
  is_list_nostat_collectors = isinstance(current_sc, list) and len(
70
72
  [sc for sc in current_sc if not isinstance(sc, common.NoStatsCollector)]) == 0
71
73
  if isinstance(current_sc, common.NoStatsCollector) or current_sc is None or is_list_nostat_collectors:
72
- stats_collector = common.StatsCollector(node.out_channel_axis)
74
+ stats_collector = common.StatsCollector(next_node_output_channel_axis if node.out_channel_axis is None else node.out_channel_axis)
73
75
  graph.set_out_stats_collector_to_node(node, stats_collector)
74
76
 
75
77
 
@@ -175,7 +177,8 @@ class ModelCollector:
175
177
  for ie in graph.incoming_edges(n):
176
178
  input_node = ie.source_node
177
179
  create_tensor2node(graph,
178
- input_node)
180
+ input_node,
181
+ n.out_channel_axis)
179
182
  if sc is not None:
180
183
  graph.set_out_stats_collector_to_node(n, sc)
181
184
 
@@ -98,6 +98,9 @@ class NodeActivationQuantizationConfig(BaseNodeQuantizationConfig):
98
98
  self.activation_quantization_params = {}
99
99
  # TODO: computed by compute_activation_bias_correction. Probably shouldnt be here.
100
100
  self.activation_bias_correction_term = None
101
+ # Z-threshold is a global param from QuantizationConfig, however it can be overridden per node by NetworkEditor.
102
+ # Since activation qparams are re-computed in several places, it's easier to keep it here and update it once.
103
+ self.z_threshold = None
101
104
 
102
105
  @property
103
106
  def enable_activation_quantization(self):
@@ -119,7 +122,7 @@ class NodeActivationQuantizationConfig(BaseNodeQuantizationConfig):
119
122
  activation_params: Dictionary that contains weight quantization params.
120
123
 
121
124
  """
122
- assert self.quant_mode == ActivationQuantizationMode.QUANT
125
+ assert self.quant_mode == ActivationQuantizationMode.QUANT or self.quant_mode == ActivationQuantizationMode.FLN_QUANT
123
126
  for param_name, param_value in activation_params.items():
124
127
  self.activation_quantization_params[param_name] = param_value
125
128
 
@@ -47,9 +47,12 @@ def compute_activation_qparams(quant_cfg: QuantizationConfig,
47
47
  node_activation_quant_cfg.activation_quantization_method, no_clipping=node_prior_info.is_output_bounded())
48
48
 
49
49
  # Extract and filter histogram data from the statistics container.
50
+ z_threshold = quant_cfg.z_threshold
51
+ if node_activation_quant_cfg.z_threshold is not None:
52
+ z_threshold = node_activation_quant_cfg.z_threshold
50
53
  bins_values, bins_counts = _get_histogram_data(out_stats_container,
51
54
  activation_error_method=quant_cfg.activation_error_method,
52
- z_threshold=quant_cfg.z_threshold)
55
+ z_threshold=z_threshold)
53
56
 
54
57
  # Retrieve the minimum and maximum values from the statistics container.
55
58
  min_value, max_value = out_stats_container.get_min_max_values()
@@ -105,7 +105,7 @@ def calculate_quantization_params(graph: Graph,
105
105
  attr_cfg.weights_channels_axis = ChannelAxisMapping(output_channels_axis, attr_cfg.weights_channels_axis.input)
106
106
  attr_cfg.set_weights_quantization_param(weights_params)
107
107
 
108
- if n.is_activation_quantization_enabled():
108
+ if n.is_activation_quantization_enabled() or n.is_fln_quantization():
109
109
  # If node's activations should be quantized as well, we compute its activation quantization parameters
110
110
  activation_params = compute_activation_qparams(quant_cfg=quant_cfg,
111
111
  node_activation_quant_cfg=candidate_qc.activation_quantization_cfg,