mct-nightly 2.3.0.20250324.606__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.
- {mct_nightly-2.3.0.20250324.606.dist-info → mct_nightly-2.3.0.20250326.530.dist-info}/METADATA +1 -1
- {mct_nightly-2.3.0.20250324.606.dist-info → mct_nightly-2.3.0.20250326.530.dist-info}/RECORD +8 -8
- {mct_nightly-2.3.0.20250324.606.dist-info → mct_nightly-2.3.0.20250326.530.dist-info}/WHEEL +1 -1
- model_compression_toolkit/__init__.py +1 -1
- model_compression_toolkit/core/common/graph/virtual_activation_weights_node.py +26 -12
- model_compression_toolkit/core/pytorch/reader/graph_builders.py +2 -0
- {mct_nightly-2.3.0.20250324.606.dist-info → mct_nightly-2.3.0.20250326.530.dist-info}/licenses/LICENSE.md +0 -0
- {mct_nightly-2.3.0.20250324.606.dist-info → mct_nightly-2.3.0.20250326.530.dist-info}/top_level.txt +0 -0
{mct_nightly-2.3.0.20250324.606.dist-info → mct_nightly-2.3.0.20250326.530.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mct-nightly
|
3
|
-
Version: 2.3.0.
|
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
|
{mct_nightly-2.3.0.20250324.606.dist-info → mct_nightly-2.3.0.20250326.530.dist-info}/RECORD
RENAMED
@@ -1,5 +1,5 @@
|
|
1
|
-
mct_nightly-2.3.0.
|
2
|
-
model_compression_toolkit/__init__.py,sha256=
|
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=
|
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
|
@@ -276,7 +276,7 @@ model_compression_toolkit/core/pytorch/quantizer/__init__.py,sha256=Rf1RcYmelmdZ
|
|
276
276
|
model_compression_toolkit/core/pytorch/quantizer/fake_quant_builder.py,sha256=D8_CEuFqKAhbUgKaRw7Jlxo0zlqgPTMu6CIIIM4LfS0,7045
|
277
277
|
model_compression_toolkit/core/pytorch/quantizer/lut_fake_quant.py,sha256=uyeBtNokyDUikk-YkDP_mN_2DX0J5oPm3kSfdSUT2Ck,4420
|
278
278
|
model_compression_toolkit/core/pytorch/reader/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
|
279
|
-
model_compression_toolkit/core/pytorch/reader/graph_builders.py,sha256=
|
279
|
+
model_compression_toolkit/core/pytorch/reader/graph_builders.py,sha256=ZASzWbYYojFYIx-ynqMTkg6mCpTrJg2oWYT-xXki4Mw,19763
|
280
280
|
model_compression_toolkit/core/pytorch/reader/node_holders.py,sha256=7XNc7-l1MZPJGcOESvtAwfIMxrU6kvt3YjF5B7qOqK4,1048
|
281
281
|
model_compression_toolkit/core/pytorch/reader/reader.py,sha256=Me6nqJpmQBg13dXYiUsmfYr148BYySBZqxHRDba5Tuk,6228
|
282
282
|
model_compression_toolkit/core/pytorch/statistics_correction/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
|
@@ -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.
|
530
|
-
mct_nightly-2.3.0.
|
531
|
-
mct_nightly-2.3.0.
|
532
|
-
mct_nightly-2.3.0.
|
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,,
|
@@ -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.
|
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.
|
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
|
-
|
151
|
-
f'Node {act_node} with kernel cannot be used as activation for
|
152
|
-
|
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.')
|
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.
|
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
|
-
|
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
|
-
|
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
|
|
@@ -220,6 +220,8 @@ def nodes_builder(model: GraphModule,
|
|
220
220
|
node_type = getattr(torch, node.target)
|
221
221
|
elif hasattr(torch.Tensor, node.target):
|
222
222
|
node_type = getattr(torch.Tensor, node.target)
|
223
|
+
if node_type==torch.Tensor.to:
|
224
|
+
Logger.critical(f"The call method \"to\" is not supported. Please consider moving \"torch.Tensor.to\" operations to init code.") # pragma: no cover
|
223
225
|
else:
|
224
226
|
Logger.critical(f"The call method '{node.target}' in {node} is not supported.") # pragma: no cover
|
225
227
|
|
File without changes
|
{mct_nightly-2.3.0.20250324.606.dist-info → mct_nightly-2.3.0.20250326.530.dist-info}/top_level.txt
RENAMED
File without changes
|