mct-nightly 2.3.0.20250423.537__py3-none-any.whl → 2.3.0.20250425.557__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.20250423.537.dist-info → mct_nightly-2.3.0.20250425.557.dist-info}/METADATA +8 -8
- {mct_nightly-2.3.0.20250423.537.dist-info → mct_nightly-2.3.0.20250425.557.dist-info}/RECORD +9 -9
- {mct_nightly-2.3.0.20250423.537.dist-info → mct_nightly-2.3.0.20250425.557.dist-info}/WHEEL +1 -1
- model_compression_toolkit/__init__.py +1 -1
- model_compression_toolkit/core/common/quantization/bit_width_config.py +6 -3
- model_compression_toolkit/core/common/quantization/set_node_quantization_config.py +10 -5
- model_compression_toolkit/core/common/substitutions/shift_negative_activation.py +7 -7
- {mct_nightly-2.3.0.20250423.537.dist-info → mct_nightly-2.3.0.20250425.557.dist-info}/licenses/LICENSE.md +0 -0
- {mct_nightly-2.3.0.20250423.537.dist-info → mct_nightly-2.3.0.20250425.557.dist-info}/top_level.txt +0 -0
{mct_nightly-2.3.0.20250423.537.dist-info → mct_nightly-2.3.0.20250425.557.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.20250425.557
|
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
|
@@ -34,7 +34,7 @@ Dynamic: summary
|
|
34
34
|
<div align="center" markdown="1">
|
35
35
|
<p>
|
36
36
|
<a href="https://sony.github.io/model_optimization/" target="_blank">
|
37
|
-
<img src="https://
|
37
|
+
<img src="https://raw.githubusercontent.com/sony/model_optimization/refs/heads/main/docsrc/images/mctHeader1-cropped.svg" width="1000"></a>
|
38
38
|
</p>
|
39
39
|
|
40
40
|
______________________________________________________________________
|
@@ -100,7 +100,7 @@ For further details, please see [Supported features and algorithms](#high-level-
|
|
100
100
|
<div align="center">
|
101
101
|
<p align="center">
|
102
102
|
|
103
|
-
<img src="https://
|
103
|
+
<img src="https://raw.githubusercontent.com/sony/model_optimization/refs/heads/main/docsrc/images/mctDiagram_clean.svg" width="800">
|
104
104
|
</p>
|
105
105
|
</div>
|
106
106
|
|
@@ -181,16 +181,16 @@ Currently, MCT is being tested on various Python, Pytorch and TensorFlow version
|
|
181
181
|
## <div align="center">Results</div>
|
182
182
|
|
183
183
|
<p align="center">
|
184
|
-
<img src="https://
|
185
|
-
<img src="https://
|
186
|
-
<img src="https://
|
187
|
-
<img src="https://
|
184
|
+
<img src="https://raw.githubusercontent.com/sony/model_optimization/refs/heads/main/docsrc/images/Classification.png" width="200">
|
185
|
+
<img src="https://raw.githubusercontent.com/sony/model_optimization/refs/heads/main/docsrc/images/SemSeg.png" width="200">
|
186
|
+
<img src="https://raw.githubusercontent.com/sony/model_optimization/refs/heads/main/docsrc/images/PoseEst.png" width="200">
|
187
|
+
<img src="https://raw.githubusercontent.com/sony/model_optimization/refs/heads/main/docsrc/images/ObjDet.png" width="200">
|
188
188
|
|
189
189
|
MCT can quantize an existing 32-bit floating-point model to an 8-bit fixed-point (or less) model without compromising accuracy.
|
190
190
|
Below is a graph of [MobileNetV2](https://pytorch.org/vision/main/models/generated/torchvision.models.mobilenet_v2.html) accuracy on ImageNet vs average bit-width of weights (X-axis), using **single-precision** quantization, **mixed-precision** quantization, and mixed-precision quantization with GPTQ.
|
191
191
|
|
192
192
|
<p align="center">
|
193
|
-
<img src="https://
|
193
|
+
<img src="https://raw.githubusercontent.com/sony/model_optimization/refs/heads/main/docsrc/images/torch_mobilenetv2.png" width="800">
|
194
194
|
|
195
195
|
For more results, please see [1]
|
196
196
|
|
{mct_nightly-2.3.0.20250423.537.dist-info → mct_nightly-2.3.0.20250425.557.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.20250425.557.dist-info/licenses/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
|
2
|
+
model_compression_toolkit/__init__.py,sha256=kXjmCqsExE8DYRx8JTVs4AhVXF1GF94SPL9EcfyLeks,1557
|
3
3
|
model_compression_toolkit/constants.py,sha256=iJ6vfTjC2oFIZWt8wvHoxEw5YJi3yl0Hd4q30_8q0Zc,3958
|
4
4
|
model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
|
5
5
|
model_compression_toolkit/logger.py,sha256=L3q7tn3Uht0i_7phnlOWMR2Te2zvzrt2HOz9vYEInts,4529
|
@@ -101,7 +101,7 @@ model_compression_toolkit/core/common/pruning/mask/__init__.py,sha256=huHoBUcKNB
|
|
101
101
|
model_compression_toolkit/core/common/pruning/mask/per_channel_mask.py,sha256=77DB1vqq_gHwbUjeCHRaq1Q-V4wEtdVdwkGezcZgToA,5021
|
102
102
|
model_compression_toolkit/core/common/pruning/mask/per_simd_group_mask.py,sha256=_LcDAxLeC5I0KdMHS8jib5XxIKO2ZLavXYuSMIPIQBo,5868
|
103
103
|
model_compression_toolkit/core/common/quantization/__init__.py,sha256=sw7LOPN1bM82o3SkMaklyH0jw-TLGK0-fl2Wq73rffI,697
|
104
|
-
model_compression_toolkit/core/common/quantization/bit_width_config.py,sha256=
|
104
|
+
model_compression_toolkit/core/common/quantization/bit_width_config.py,sha256=034kgwe0ydyLXsV83KqxKyyHkoUQH06ai0leLyg0p8I,13019
|
105
105
|
model_compression_toolkit/core/common/quantization/candidate_node_quantization_config.py,sha256=lyWPvnoX8BmulhLKR20r5gT2_Yan7P40d8EcgDhErPk,4905
|
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
|
@@ -112,7 +112,7 @@ model_compression_toolkit/core/common/quantization/quantization_fn_selection.py,
|
|
112
112
|
model_compression_toolkit/core/common/quantization/quantization_params_fn_selection.py,sha256=7eG7dl1TcbdnHwgmvyjarxLs0o6Lw_9VAjXAm4rsiBk,3791
|
113
113
|
model_compression_toolkit/core/common/quantization/quantize_graph_weights.py,sha256=N005MSvx8UypVpa7XrxNrB2G732n2wHj3RmLyjTgd3I,2728
|
114
114
|
model_compression_toolkit/core/common/quantization/quantize_node.py,sha256=cdzGNWfT4MRogIU8ehs0tr3lVjnzAI-jeoS9b4TwVBo,2854
|
115
|
-
model_compression_toolkit/core/common/quantization/set_node_quantization_config.py,sha256=
|
115
|
+
model_compression_toolkit/core/common/quantization/set_node_quantization_config.py,sha256=76BjqZbeRz7zIblKxGp-AUkHOt-KZMlYjsXP8Ph-1jc,30943
|
116
116
|
model_compression_toolkit/core/common/quantization/quantization_params_generation/__init__.py,sha256=eCDGwsWYLU6z7qbEVb4TozMW_nd5VEP_iCJ6PcvyEPw,1486
|
117
117
|
model_compression_toolkit/core/common/quantization/quantization_params_generation/error_functions.py,sha256=_m-XkEMJMHf0gYwVIXAoHVjdRa2NXt_gYdwBlw76ZR8,24031
|
118
118
|
model_compression_toolkit/core/common/quantization/quantization_params_generation/lut_kmeans_params.py,sha256=RL-PklAjGyC-26anSt8fU07a6pB_LBQFQy9o4e9giN0,8739
|
@@ -145,7 +145,7 @@ model_compression_toolkit/core/common/substitutions/linear_collapsing_substituti
|
|
145
145
|
model_compression_toolkit/core/common/substitutions/remove_identity.py,sha256=TKU1TIU52UIkVnl0EZvWnDhLV9nIVZ4hqi-w1i4NXMk,2637
|
146
146
|
model_compression_toolkit/core/common/substitutions/residual_collapsing.py,sha256=N82mso5j3EJQlKt9EMHjjEJ67FmdGQeCfN8U5grOFXo,4830
|
147
147
|
model_compression_toolkit/core/common/substitutions/scale_equalization.py,sha256=p57u25qdW2pimxzGwgMXEBV4S-LzXuTVAlIM7830WfU,10966
|
148
|
-
model_compression_toolkit/core/common/substitutions/shift_negative_activation.py,sha256=
|
148
|
+
model_compression_toolkit/core/common/substitutions/shift_negative_activation.py,sha256=zCkdyZHEkbxkORmd071_XWajkpIhnDq9D6FyeE4TQjc,30057
|
149
149
|
model_compression_toolkit/core/common/substitutions/softmax_shift.py,sha256=R-0ZqhYAuZLEFWHvB2UTPm52L6gWHGdRdEnwGxKSeGI,2625
|
150
150
|
model_compression_toolkit/core/common/substitutions/virtual_activation_weights_composition.py,sha256=w43dRmaG96a8SNECgghxoFCTSoZ-vUb33dXGm2PbomE,4251
|
151
151
|
model_compression_toolkit/core/common/substitutions/weights_activation_split.py,sha256=gt07lXRUvYunJKiwv_w20zfXhcplSW4oT2C1dqiNNXc,4719
|
@@ -528,7 +528,7 @@ model_compression_toolkit/xquant/pytorch/model_analyzer.py,sha256=b93o800yVB3Z-i
|
|
528
528
|
model_compression_toolkit/xquant/pytorch/pytorch_report_utils.py,sha256=UVN_S9ULHBEldBpShCOt8-soT8YTQ5oE362y96qF_FA,3950
|
529
529
|
model_compression_toolkit/xquant/pytorch/similarity_functions.py,sha256=CERxq5K8rqaiE-DlwhZBTUd9x69dtYJlkHOPLB54vm8,2354
|
530
530
|
model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=mkoEktLFFHtEKzzFRn_jCnxjhJolK12TZ5AQeDHzUO8,9767
|
531
|
-
mct_nightly-2.3.0.
|
532
|
-
mct_nightly-2.3.0.
|
533
|
-
mct_nightly-2.3.0.
|
534
|
-
mct_nightly-2.3.0.
|
531
|
+
mct_nightly-2.3.0.20250425.557.dist-info/METADATA,sha256=3W1evd1H2JL0wpqb1frzmmX5nz2fqHcMib1y3remRt8,25560
|
532
|
+
mct_nightly-2.3.0.20250425.557.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
533
|
+
mct_nightly-2.3.0.20250425.557.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
|
534
|
+
mct_nightly-2.3.0.20250425.557.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.20250425.000557"
|
@@ -20,6 +20,8 @@ from model_compression_toolkit.core.common.matchers.node_matcher import BaseNode
|
|
20
20
|
from model_compression_toolkit.logger import Logger
|
21
21
|
|
22
22
|
from model_compression_toolkit.core.common.graph.base_node import WeightAttrT
|
23
|
+
from model_compression_toolkit.target_platform_capabilities.constants import POS_ATTR
|
24
|
+
|
23
25
|
|
24
26
|
@dataclass
|
25
27
|
class ManualBitWidthSelection:
|
@@ -221,9 +223,10 @@ class BitWidthConfig:
|
|
221
223
|
if isinstance(attr_str, str) and isinstance(manual_bit_width_selection.attr, str):
|
222
224
|
if attr_str.find(manual_bit_width_selection.attr) != -1:
|
223
225
|
attr.append(attr_str)
|
224
|
-
|
225
|
-
|
226
|
-
|
226
|
+
# this is a positional attribute, so it needs to be handled separately.
|
227
|
+
# Search manual_bit_width_selection's attribute that contain the POS_ATTR string.
|
228
|
+
elif isinstance(attr_str, int) and POS_ATTR in manual_bit_width_selection.attr:
|
229
|
+
attr.append(POS_ATTR)
|
227
230
|
if len(attr) == 0:
|
228
231
|
Logger.critical(f'The requested attribute {manual_bit_width_selection.attr} to change the bit width for {n} does not exist.')
|
229
232
|
|
@@ -119,11 +119,16 @@ def filter_node_qco_by_graph(node: BaseNode,
|
|
119
119
|
_next_nodes.extend(graph.get_next_nodes(n))
|
120
120
|
next_nodes.append(n)
|
121
121
|
|
122
|
-
if len(next_nodes):
|
123
|
-
|
124
|
-
|
122
|
+
if len(next_nodes) == 0:
|
123
|
+
return _base_config, _node_qc_options
|
124
|
+
next_nodes_qc_options = [_node.get_qco(fqc) for _node in next_nodes]
|
125
|
+
all_next_nodes_supported_input_bitwidth = [max_input_activation_n_bits(op_cfg)
|
125
126
|
for qc_opts in next_nodes_qc_options
|
126
|
-
for op_cfg in qc_opts.quantization_configurations
|
127
|
+
for op_cfg in qc_opts.quantization_configurations
|
128
|
+
if op_cfg.enable_activation_quantization or op_cfg.quantization_preserving
|
129
|
+
]
|
130
|
+
if len(all_next_nodes_supported_input_bitwidth):
|
131
|
+
next_nodes_supported_input_bitwidth = min(all_next_nodes_supported_input_bitwidth)
|
127
132
|
|
128
133
|
# Filter node's QC options that match next nodes input bit-width.
|
129
134
|
_node_qc_options = [_option for _option in _node_qc_options
|
@@ -205,7 +210,7 @@ def set_quantization_configs_to_node(node: BaseNode,
|
|
205
210
|
# Preserving the quantization of more than 1 previous node is ambiguous, so disable it.
|
206
211
|
Logger.info(f"Disabling Quantization-Preserving for node {node.name} because it has more than 1 input activations.")
|
207
212
|
candidate_qc.activation_quantization_cfg.quant_mode = ActivationQuantizationMode.NO_QUANT
|
208
|
-
elif not prev_nodes[0].is_quantization_preserving()
|
213
|
+
elif not prev_nodes[0].is_quantization_preserving() and not prev_nodes[0].is_activation_quantization_enabled():
|
209
214
|
# Preserving the quantization of an unquantized node isn't possible, so disable it.
|
210
215
|
Logger.info(f"Disabling Quantization-Preserving for node {node.name} because previous node activation quantization is disabled.")
|
211
216
|
candidate_qc.activation_quantization_cfg.quant_mode = ActivationQuantizationMode.NO_QUANT
|
@@ -343,6 +343,13 @@ def shift_negative_function(graph: Graph,
|
|
343
343
|
graph.set_out_stats_collector_to_node(add_node, add_node_stats_collector)
|
344
344
|
graph.shift_stats_collector(add_node, np.array(shift_value))
|
345
345
|
|
346
|
+
set_quantization_configs_to_node(fw_info=fw_info,
|
347
|
+
node=add_node,
|
348
|
+
graph=graph,
|
349
|
+
quant_config=core_config.quantization_config,
|
350
|
+
fqc=graph.fqc,
|
351
|
+
mixed_precision_enable=core_config.is_mixed_precision_enabled)
|
352
|
+
|
346
353
|
if padding is not None:
|
347
354
|
pad_node = create_pad_node(op2d_node.name,
|
348
355
|
add_node.name,
|
@@ -373,13 +380,6 @@ def shift_negative_function(graph: Graph,
|
|
373
380
|
|
374
381
|
op2d_node.input_shape = pad_node.output_shape
|
375
382
|
|
376
|
-
set_quantization_configs_to_node(fw_info=fw_info,
|
377
|
-
node=add_node,
|
378
|
-
graph=graph,
|
379
|
-
quant_config=core_config.quantization_config,
|
380
|
-
fqc=graph.fqc,
|
381
|
-
mixed_precision_enable=core_config.is_mixed_precision_enabled)
|
382
|
-
|
383
383
|
original_non_linear_activation_nbits = non_linear_node_cfg_candidate.activation_n_bits
|
384
384
|
# The non-linear node's output should be float, so we approximate it by using 16bits quantization.
|
385
385
|
for candidate_qc in non_linear_node.candidates_quantization_cfg:
|
File without changes
|
{mct_nightly-2.3.0.20250423.537.dist-info → mct_nightly-2.3.0.20250425.557.dist-info}/top_level.txt
RENAMED
File without changes
|