mct-nightly 2.3.0.20250325.524__py3-none-any.whl → 2.3.0.20250326.530__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.3.0.20250325.524
3
+ Version: 2.3.0.20250326.530
4
4
  Summary: A Model Compression Toolkit for neural networks
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -1,5 +1,5 @@
1
- mct_nightly-2.3.0.20250325.524.dist-info/licenses/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
2
- model_compression_toolkit/__init__.py,sha256=QA19v194uXWUuLFh_Bg-8ll7InFUcGC8RGNV-Gi7qcc,1557
1
+ mct_nightly-2.3.0.20250326.530.dist-info/licenses/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
2
+ model_compression_toolkit/__init__.py,sha256=gSeiAYEHLULbQCz6nMC1R8DaMzUa8j-KQuBiwt6lYqs,1557
3
3
  model_compression_toolkit/constants.py,sha256=i_R6uXBfO1ph_X6DNJych2x59SUojfJbn7dNjs_mZnc,3846
4
4
  model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
5
5
  model_compression_toolkit/logger.py,sha256=L3q7tn3Uht0i_7phnlOWMR2Te2zvzrt2HOz9vYEInts,4529
@@ -40,7 +40,7 @@ model_compression_toolkit/core/common/graph/edge.py,sha256=buoSEUZwilWBK3WeBKpJ-
40
40
  model_compression_toolkit/core/common/graph/functional_node.py,sha256=GH5wStmw8SoAj5IdT_-ItN1Meo_P5NUTt_5bgJC4fak,3935
41
41
  model_compression_toolkit/core/common/graph/graph_matchers.py,sha256=CrDoHYq4iPaflgJWmoJ1K4ziLrRogJvFTVWg8P0UcDU,4744
42
42
  model_compression_toolkit/core/common/graph/graph_searches.py,sha256=2oKuW6L8hP-oL0lFO9PhQFt9fEFgVJwpc1u4fHExAtE,5128
43
- model_compression_toolkit/core/common/graph/virtual_activation_weights_node.py,sha256=gPlGMyC5jdUTQy8jYU_Rz7cPXSH6JhV4Dnwt3-1FAKM,9849
43
+ model_compression_toolkit/core/common/graph/virtual_activation_weights_node.py,sha256=JH33qnHTaqFXcYSzTVMpDc9N93503y2pY3hiVJELuZI,10704
44
44
  model_compression_toolkit/core/common/graph/memory_graph/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
45
45
  model_compression_toolkit/core/common/graph/memory_graph/bipartite_graph.py,sha256=X6FK3C3y8ixFRPjC_wm3ClloCX8_06SOdA1TRi7o_LA,3800
46
46
  model_compression_toolkit/core/common/graph/memory_graph/compute_graph_max_cut.py,sha256=oyz260JXDbvL8aI-DVtUvLHtLRWC2Yu4SBYlGL68c2Y,3498
@@ -526,7 +526,7 @@ model_compression_toolkit/xquant/pytorch/model_analyzer.py,sha256=b93o800yVB3Z-i
526
526
  model_compression_toolkit/xquant/pytorch/pytorch_report_utils.py,sha256=UVN_S9ULHBEldBpShCOt8-soT8YTQ5oE362y96qF_FA,3950
527
527
  model_compression_toolkit/xquant/pytorch/similarity_functions.py,sha256=CERxq5K8rqaiE-DlwhZBTUd9x69dtYJlkHOPLB54vm8,2354
528
528
  model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=mkoEktLFFHtEKzzFRn_jCnxjhJolK12TZ5AQeDHzUO8,9767
529
- mct_nightly-2.3.0.20250325.524.dist-info/METADATA,sha256=AhiPNPdqyMvdK9V7IcGS0EUifEcnl9RhI_IsME0A5-U,27098
530
- mct_nightly-2.3.0.20250325.524.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
531
- mct_nightly-2.3.0.20250325.524.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
532
- mct_nightly-2.3.0.20250325.524.dist-info/RECORD,,
529
+ mct_nightly-2.3.0.20250326.530.dist-info/METADATA,sha256=1X5lOxeRXgvufbknPta8w4pcm1rGL0N1q-Ba7cUDIyA,27098
530
+ mct_nightly-2.3.0.20250326.530.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
531
+ mct_nightly-2.3.0.20250326.530.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
532
+ mct_nightly-2.3.0.20250326.530.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.0.2)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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.3.0.20250325.000524"
30
+ __version__ = "2.3.0.20250326.000530"
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
+ import uuid
15
16
 
16
17
  from typing import Dict, Any, Tuple
17
18
 
@@ -139,23 +140,34 @@ class VirtualActivationWeightsNode(BaseNode):
139
140
  """
140
141
  # Validate weights node
141
142
  kernel_attrs = fw_info.get_kernel_op_attributes(weights_node.type)
142
- assert len(kernel_attrs) == 1 and kernel_attrs[0] is not None, 'Expected exactly one kernel attr.'
143
+ assert len(kernel_attrs) == 1 and kernel_attrs[0] is not None, f'Expected exactly one kernel attr, {kernel_attrs}'
143
144
  kernel_attr = kernel_attrs[0]
144
145
  conf_weights = [attr for attr in weights_node.weights if weights_node.is_configurable_weight(attr)]
145
146
  if len(conf_weights) > 1 or len(conf_weights) == 1 and not weights_node.is_configurable_weight(kernel_attr):
146
- raise NotImplementedError('Only kernel weight can be configurable.') # pragma: no cover
147
+ raise NotImplementedError(f'Only kernel weight can be configurable. Got configurable {conf_weights}.')
147
148
 
148
- weights = weights_node.weights
149
+ weights = weights_node.weights.copy()
150
+ act_node_w_rename = {}
149
151
  if act_node.weights:
150
- assert fw_info.get_kernel_op_attributes(act_node)[0] is None, \
151
- f'Node {act_node} with kernel cannot be used as activation for VirtualActivationWeightsNode.'
152
- if set(weights_node.weights.keys()).intersection(set(act_node.weights.keys())):
153
- raise ValueError('Activation and weight nodes are not expected to have the same weight attribute') # pragma: no cover
152
+ if not fw_info.get_kernel_op_attributes(act_node)[0] is None:
153
+ raise NotImplementedError(f'Node {act_node} with kernel cannot be used as activation for '
154
+ f'VirtualActivationWeightsNode.')
154
155
  if act_node.has_any_configurable_weight():
155
- raise NotImplementedError('Node with a configurable weight cannot be used as activation for '
156
- 'VirtualActivationWeightsNode.') # pragma: no cover
156
+ raise NotImplementedError(f'Node {act_node} with a configurable weight cannot be used as activation for '
157
+ 'VirtualActivationWeightsNode.')
157
158
  # combine weights from activation and weights
158
- weights.update(act_node.weights)
159
+ for w_id, w in act_node.weights.items():
160
+ if w_id not in weights and not (isinstance(w_id, str) and kernel_attr in w_id):
161
+ weights[w_id] = w
162
+ continue
163
+ # if same identifier is used as in weight nodes (or contains the kernel substring), generate a new
164
+ # unique id. If positional, generate a new (and clearly made up) index.
165
+ # This only serves for resource utilization computation so in theory this shouldn't matter, as long as
166
+ # quantization config dict keys are updated accordingly.
167
+ uniq_id = uuid.uuid4().hex[:8] if isinstance(w_id, str) else (100 + w_id)
168
+ assert uniq_id not in weights
169
+ act_node_w_rename[w_id] = uniq_id
170
+ weights[uniq_id] = w
159
171
 
160
172
  name = f"{VIRTUAL_ACTIVATION_WEIGHTS_NODE_PREFIX}_{act_node.name}_{weights_node.name}"
161
173
  super().__init__(name,
@@ -181,10 +193,12 @@ class VirtualActivationWeightsNode(BaseNode):
181
193
  if act_node.weights:
182
194
  # add non-kernel weights cfg from activation node to the composed node's weights cfg
183
195
  composed_candidate.weights_quantization_cfg.attributes_config_mapping.update(
184
- c_a.weights_quantization_cfg.attributes_config_mapping
196
+ {act_node_w_rename.get(k, k): v
197
+ for k, v in c_a.weights_quantization_cfg.attributes_config_mapping.items()}
185
198
  )
186
199
  composed_candidate.weights_quantization_cfg.pos_attributes_config_mapping.update(
187
- c_a.weights_quantization_cfg.pos_attributes_config_mapping
200
+ {act_node_w_rename.get(k, k): v
201
+ for k, v in c_a.weights_quantization_cfg.pos_attributes_config_mapping.items()}
188
202
  )
189
203
  v_candidates.append(composed_candidate)
190
204