mct-nightly 2.3.0.20250507.555__py3-none-any.whl → 2.3.0.20250509.604__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.20250507.555.dist-info → mct_nightly-2.3.0.20250509.604.dist-info}/METADATA +9 -9
- {mct_nightly-2.3.0.20250507.555.dist-info → mct_nightly-2.3.0.20250509.604.dist-info}/RECORD +16 -16
- model_compression_toolkit/__init__.py +1 -1
- model_compression_toolkit/core/pytorch/back2framework/mixed_precision_model_builder.py +3 -2
- model_compression_toolkit/core/pytorch/back2framework/pytorch_model_builder.py +17 -9
- model_compression_toolkit/core/pytorch/reader/reader.py +1 -1
- model_compression_toolkit/exporter/model_exporter/pytorch/fakely_quant_onnx_pytorch_exporter.py +7 -6
- model_compression_toolkit/exporter/model_exporter/pytorch/pytorch_export_facade.py +4 -0
- model_compression_toolkit/exporter/model_wrapper/pytorch/builder/fully_quantized_model_builder.py +14 -9
- model_compression_toolkit/gptq/pytorch/gptq_training.py +3 -2
- model_compression_toolkit/qat/pytorch/quantizer/quantization_builder.py +3 -2
- model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2keras.py +1 -1
- model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2pytorch.py +1 -1
- {mct_nightly-2.3.0.20250507.555.dist-info → mct_nightly-2.3.0.20250509.604.dist-info}/WHEEL +0 -0
- {mct_nightly-2.3.0.20250507.555.dist-info → mct_nightly-2.3.0.20250509.604.dist-info}/licenses/LICENSE.md +0 -0
- {mct_nightly-2.3.0.20250507.555.dist-info → mct_nightly-2.3.0.20250509.604.dist-info}/top_level.txt +0 -0
{mct_nightly-2.3.0.20250507.555.dist-info → mct_nightly-2.3.0.20250509.604.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.20250509.604
|
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
|
@@ -23,7 +23,7 @@ Requires-Dist: scipy
|
|
23
23
|
Requires-Dist: protobuf
|
24
24
|
Requires-Dist: mct-quantizers-nightly
|
25
25
|
Requires-Dist: pydantic>=2.0
|
26
|
-
Requires-Dist:
|
26
|
+
Requires-Dist: edge-mdt-cl-dev
|
27
27
|
Dynamic: author-email
|
28
28
|
Dynamic: classifier
|
29
29
|
Dynamic: description
|
@@ -52,7 +52,7 @@ ______________________________________________________________________
|
|
52
52
|
<a href="#license">License</a>
|
53
53
|
</p>
|
54
54
|
<p align="center">
|
55
|
-
<a href="https://sony.github.io/model_optimization#prerequisites"><img src="https://img.shields.io/badge/pytorch-2.
|
55
|
+
<a href="https://sony.github.io/model_optimization#prerequisites"><img src="https://img.shields.io/badge/pytorch-2.3%20%7C%202.4%20%7C%202.5%20%7C%202.6-blue" /></a>
|
56
56
|
<a href="https://sony.github.io/model_optimization#prerequisites"><img src="https://img.shields.io/badge/tensorflow-2.14%20%7C%202.15-blue" /></a>
|
57
57
|
<a href="https://sony.github.io/model_optimization#prerequisites"><img src="https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue" /></a>
|
58
58
|
<a href="https://github.com/sony/model_optimization/releases"><img src="https://img.shields.io/github/v/release/sony/model_optimization" /></a>
|
@@ -65,7 +65,7 @@ ________________________________________________________________________________
|
|
65
65
|
|
66
66
|
## <div align="center">Getting Started</div>
|
67
67
|
### Quick Installation
|
68
|
-
Pip install the model compression toolkit package in a Python>=3.9 environment with PyTorch>=2.
|
68
|
+
Pip install the model compression toolkit package in a Python>=3.9 environment with PyTorch>=2.3 or Tensorflow>=2.14.
|
69
69
|
```
|
70
70
|
pip install model-compression-toolkit
|
71
71
|
```
|
@@ -165,12 +165,12 @@ Currently, MCT is being tested on various Python, Pytorch and TensorFlow version
|
|
165
165
|
<details id="supported-versions">
|
166
166
|
<summary>Supported Versions Table</summary>
|
167
167
|
|
168
|
-
|
|
168
|
+
| | PyTorch 2.3 | PyTorch 2.4 | PyTorch 2.5 | PyTorch 2.6 |
|
169
169
|
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
170
|
-
| Python 3.9
|
171
|
-
| Python 3.10 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python39_pytorch23.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python39_pytorch24.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python39_pytorch25.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python39_pytorch26.yml) |
|
171
|
+
| Python 3.10 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_pytorch23.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_pytorch24.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_pytorch25.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_pytorch26.yml) |
|
172
|
+
| Python 3.11 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_pytorch23.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_pytorch24.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_pytorch25.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_pytorch26.yml) |
|
173
|
+
| Python 3.12 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python312_pytorch23.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python312_pytorch24.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python312_pytorch25.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python312_pytorch26.yml) |
|
174
174
|
|
175
175
|
| | TensorFlow 2.14 | TensorFlow 2.15 |
|
176
176
|
|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
{mct_nightly-2.3.0.20250507.555.dist-info → mct_nightly-2.3.0.20250509.604.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.20250509.604.dist-info/licenses/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
|
2
|
+
model_compression_toolkit/__init__.py,sha256=NmjwLR-DEKpXZFNnPxDfGG0EnYOLzkJNkYrr2NdSRQs,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
|
@@ -232,8 +232,8 @@ model_compression_toolkit/core/pytorch/back2framework/__init__.py,sha256=H_WixgN
|
|
232
232
|
model_compression_toolkit/core/pytorch/back2framework/factory_model_builder.py,sha256=bwppTPRs6gL96nm7qPiKrNcBj4Krr0yEsOWjRF0aXmQ,2339
|
233
233
|
model_compression_toolkit/core/pytorch/back2framework/float_model_builder.py,sha256=tLrlUyYhxVKVjkad1ZAtbRra0HedB3iVfIkZ_dYnQ-4,3419
|
234
234
|
model_compression_toolkit/core/pytorch/back2framework/instance_builder.py,sha256=BBHBfTqeWm7L3iDyPBpk0jxvj-rBg1QWI23imkjfIl0,1467
|
235
|
-
model_compression_toolkit/core/pytorch/back2framework/mixed_precision_model_builder.py,sha256=
|
236
|
-
model_compression_toolkit/core/pytorch/back2framework/pytorch_model_builder.py,sha256=
|
235
|
+
model_compression_toolkit/core/pytorch/back2framework/mixed_precision_model_builder.py,sha256=Pyk2hrwCB-9HyhZUqtKFK_t6YBL5yKB-S0CStfEhx_M,14675
|
236
|
+
model_compression_toolkit/core/pytorch/back2framework/pytorch_model_builder.py,sha256=Z-ZQV-GWdOBGPbksiWBQ8MtFkQ41qgUKU5d5c8aNSjQ,21646
|
237
237
|
model_compression_toolkit/core/pytorch/back2framework/quantized_model_builder.py,sha256=qZNNOlNTTV4ZKPG3q5GDXkIVTPUEr8dvxAS_YiMORmg,3456
|
238
238
|
model_compression_toolkit/core/pytorch/back2framework/quantization_wrapper/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
|
239
239
|
model_compression_toolkit/core/pytorch/back2framework/quantization_wrapper/quantized_layer_wrapper.py,sha256=q2JDw10NKng50ee2i9faGzWZ-IydnR2aOMGSn9RoZmc,5773
|
@@ -278,7 +278,7 @@ model_compression_toolkit/core/pytorch/quantizer/lut_fake_quant.py,sha256=uyeBtN
|
|
278
278
|
model_compression_toolkit/core/pytorch/reader/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
|
279
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
|
-
model_compression_toolkit/core/pytorch/reader/reader.py,sha256=
|
281
|
+
model_compression_toolkit/core/pytorch/reader/reader.py,sha256=fXno0BQrtjhe3YnkDyjQLdeCz0e1KD8yFXjpXjCPGZ4,7432
|
282
282
|
model_compression_toolkit/core/pytorch/statistics_correction/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
|
283
283
|
model_compression_toolkit/core/pytorch/statistics_correction/apply_second_moment_correction.py,sha256=VgU24J3jf7QComHH7jonOXSkg6mO4TOch3uFkOthZvM,3261
|
284
284
|
model_compression_toolkit/core/pytorch/statistics_correction/pytorch_compute_activation_bias_correction_of_graph.py,sha256=N-9QaEaQYUsIoya9Lc0ZDoMZ0fkiT2gFpOd4zXHKP34,3096
|
@@ -335,9 +335,9 @@ model_compression_toolkit/exporter/model_exporter/keras/mctq_keras_exporter.py,s
|
|
335
335
|
model_compression_toolkit/exporter/model_exporter/pytorch/__init__.py,sha256=uZ2RigbY9O2PJ0Il8wPpS_s7frgg9WUGd_SHeKGyl1A,699
|
336
336
|
model_compression_toolkit/exporter/model_exporter/pytorch/base_pytorch_exporter.py,sha256=UPVkEUQCMZ4Lld6CRnEOPEmlfe5vcQZG0Q3FwRBodD4,4021
|
337
337
|
model_compression_toolkit/exporter/model_exporter/pytorch/export_serialization_format.py,sha256=bPevy6OBqng41PqytBR55e6cBEuyrUS0H8dWX4zgjQ4,967
|
338
|
-
model_compression_toolkit/exporter/model_exporter/pytorch/fakely_quant_onnx_pytorch_exporter.py,sha256=
|
338
|
+
model_compression_toolkit/exporter/model_exporter/pytorch/fakely_quant_onnx_pytorch_exporter.py,sha256=v6DwLNZX5RcWHUfYXfJZXNFXPfHsMm5Wl0N29o0diSc,8856
|
339
339
|
model_compression_toolkit/exporter/model_exporter/pytorch/fakely_quant_torchscript_pytorch_exporter.py,sha256=ksWV2A-Njo-wAxQ_Ye2sLIZXBWJ_WNyjT7-qFFwvV2o,2897
|
340
|
-
model_compression_toolkit/exporter/model_exporter/pytorch/pytorch_export_facade.py,sha256=
|
340
|
+
model_compression_toolkit/exporter/model_exporter/pytorch/pytorch_export_facade.py,sha256=I2YZOwzTMLcclGJoruFrHJlOt5mepodX7mGw_GbnqxA,6372
|
341
341
|
model_compression_toolkit/exporter/model_wrapper/__init__.py,sha256=7CF2zvpTrIEm8qnbuHnLZyTZkwBBxV24V8QA0oxGbh0,1187
|
342
342
|
model_compression_toolkit/exporter/model_wrapper/fw_agnostic/__init__.py,sha256=pKAdbTCFM_2BrZXUtTIw0ouKotrWwUDF_hP3rPwCM2k,696
|
343
343
|
model_compression_toolkit/exporter/model_wrapper/fw_agnostic/get_inferable_quantizers.py,sha256=Bd3QhAR__YC9Xmobd5qHv9ofh_rPn_eTFV0sXizcBnY,2297
|
@@ -349,7 +349,7 @@ model_compression_toolkit/exporter/model_wrapper/keras/builder/node_to_quantizer
|
|
349
349
|
model_compression_toolkit/exporter/model_wrapper/pytorch/__init__.py,sha256=Rf1RcYmelmdZmBV5qOKvKWF575ofc06JFQSq83Jz99A,696
|
350
350
|
model_compression_toolkit/exporter/model_wrapper/pytorch/validate_layer.py,sha256=vQUGbCi8_pGoN8DwQ0IblSeN6L9t6Cr0reZNuCbBpkM,3469
|
351
351
|
model_compression_toolkit/exporter/model_wrapper/pytorch/builder/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
|
352
|
-
model_compression_toolkit/exporter/model_wrapper/pytorch/builder/fully_quantized_model_builder.py,sha256=
|
352
|
+
model_compression_toolkit/exporter/model_wrapper/pytorch/builder/fully_quantized_model_builder.py,sha256=gKLKQaVlIx8Rt04aA5EXnG53D1x5N8gaSfUnmip3UK4,6851
|
353
353
|
model_compression_toolkit/exporter/model_wrapper/pytorch/builder/node_to_quantizer.py,sha256=Pl8a8MSZMzNbm5vngujFjCt_iSMbSmKjlcL1DvN9nTM,9292
|
354
354
|
model_compression_toolkit/gptq/__init__.py,sha256=pEgkJvmf05KSw70iLDTz_6LI_2Oi5L8sTN0JsEUpnpk,1445
|
355
355
|
model_compression_toolkit/gptq/runner.py,sha256=La12JTYjWyJW0YW4Al4TP1_Xi4JWBCEKw6FR_JQsxe0,5982
|
@@ -380,7 +380,7 @@ model_compression_toolkit/gptq/keras/quantizer/ste_rounding/symmetric_ste.py,sha
|
|
380
380
|
model_compression_toolkit/gptq/pytorch/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws4dd9F2UDrmjKzTN8G0V0,697
|
381
381
|
model_compression_toolkit/gptq/pytorch/gptq_loss.py,sha256=_07Zx_43bnNokwR5S8phIqeu5-_7_5VBT4DT-FCw7Do,3892
|
382
382
|
model_compression_toolkit/gptq/pytorch/gptq_pytorch_implementation.py,sha256=tECPTavxn8EEwgLaP2zvxdJH6Vg9jC0YOIMJ7857Sdc,1268
|
383
|
-
model_compression_toolkit/gptq/pytorch/gptq_training.py,sha256=
|
383
|
+
model_compression_toolkit/gptq/pytorch/gptq_training.py,sha256=Vz_3xNjMSV4WzFh11EInxsnh3HZerAUkYtuMXh0ylpw,19693
|
384
384
|
model_compression_toolkit/gptq/pytorch/graph_info.py,sha256=4mVM-VvnBaA64ACVdOe6wTGHdMSa2UTLIUe7nACLcdo,4008
|
385
385
|
model_compression_toolkit/gptq/pytorch/quantization_facade.py,sha256=V_T3EbFiHO3SkN0kvppsEB9IFW8Q68_GMtUf3xjHnXU,17445
|
386
386
|
model_compression_toolkit/gptq/pytorch/quantizer/__init__.py,sha256=ZHNHo1yzye44m9_ht4UUZfTpK01RiVR3Tr74-vtnOGI,968
|
@@ -423,7 +423,7 @@ model_compression_toolkit/qat/pytorch/__init__.py,sha256=cco4TmeIDIh32nj9ZZXVkws
|
|
423
423
|
model_compression_toolkit/qat/pytorch/quantization_facade.py,sha256=M4u2V12y_B_EFoT52iky4J3ebYCkT2cPu7TUKTir0fQ,14082
|
424
424
|
model_compression_toolkit/qat/pytorch/quantizer/__init__.py,sha256=xYa4C8pr9cG1f3mQQcBXO_u3IdJN-zl7leZxuXDs86w,1003
|
425
425
|
model_compression_toolkit/qat/pytorch/quantizer/base_pytorch_qat_weight_quantizer.py,sha256=gjzrnBAZr5c_OrDpSjxpQYa_jKImv7ll52cng07_2oE,1813
|
426
|
-
model_compression_toolkit/qat/pytorch/quantizer/quantization_builder.py,sha256=
|
426
|
+
model_compression_toolkit/qat/pytorch/quantizer/quantization_builder.py,sha256=f8-TuAHyWU4R2Mxb4DoTIwGnxYjUG7sgmlyLY_Ixf2A,5892
|
427
427
|
model_compression_toolkit/qat/pytorch/quantizer/lsq/__init__.py,sha256=huHoBUcKNB6BnY6YaUCcFvdyBtBI172ZoUD8ZYeNc6o,696
|
428
428
|
model_compression_toolkit/qat/pytorch/quantizer/lsq/symmetric_lsq.py,sha256=QhJdOpMKIRuKBfwnW53YtqvcFcDXAllDk_WjdR5-FFs,5887
|
429
429
|
model_compression_toolkit/qat/pytorch/quantizer/lsq/uniform_lsq.py,sha256=KefO2ZvgJCcDWsvqkYwLb4MfBdv6z889afxOCoUybbg,5534
|
@@ -442,8 +442,8 @@ model_compression_toolkit/target_platform_capabilities/schema/v1.py,sha256=oWKNQ
|
|
442
442
|
model_compression_toolkit/target_platform_capabilities/schema/v2.py,sha256=hryYeGK0zJ2ffcRpHihudtYpl8kIl1WTAQOEsyerqlM,10813
|
443
443
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/__init__.py,sha256=XjNws3zoiJkeH4ixKqrLA5xBvpv5rq31qX7wYQjNpZM,1447
|
444
444
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2fw.py,sha256=HJ8uc3PFfyxg-WpVXPBg4mGaox8Z9bRqtQNbRfIyAk4,3745
|
445
|
-
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2keras.py,sha256=
|
446
|
-
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2pytorch.py,sha256=
|
445
|
+
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2keras.py,sha256=9r_lDvRYtbGLKjnH1yLuP4vxWn0_4xS4AkdDhvBg7Ko,7154
|
446
|
+
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2pytorch.py,sha256=NCwuvnByeexLL987h67XhU8vQvCgq63bt0hFSiSSxvE,6400
|
447
447
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attribute_filter.py,sha256=jfhszvuD2Fyy6W2KjlLzXBQKFzTqGAaDZeFVr4-ONQw,8776
|
448
448
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/current_tpc.py,sha256=_kFG0USYa6yzvLsi82_Vusv_KR8Hi7J1u680pPXECuo,2192
|
449
449
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/framework_quantization_capabilities.py,sha256=UKzckLYLdBcFAptyKnVMwpPpfRkmF0SK1Kl0g0eGjQA,9710
|
@@ -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.20250509.604.dist-info/METADATA,sha256=ztlKcwx02set5cVN9IFDXppgxhxYIOweHfFb3fI2rEg,25136
|
532
|
+
mct_nightly-2.3.0.20250509.604.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
533
|
+
mct_nightly-2.3.0.20250509.604.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
|
534
|
+
mct_nightly-2.3.0.20250509.604.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.20250509.000604"
|
@@ -143,7 +143,7 @@ class MixedPrecisionPyTorchModelBuilder(PyTorchModelBuilder):
|
|
143
143
|
'max_candidate_idx': max_candidate_idx
|
144
144
|
}
|
145
145
|
|
146
|
-
def mixed_precision_activation_holder(self, n: BaseNode) -> PytorchActivationQuantizationHolder:
|
146
|
+
def mixed_precision_activation_holder(self, n: BaseNode, holder_type: PytorchActivationQuantizationHolder = PytorchActivationQuantizationHolder) -> PytorchActivationQuantizationHolder:
|
147
147
|
"""
|
148
148
|
Retrieve a PytorchActivationQuantizationHolder layer to use for activation quantization for a node.
|
149
149
|
The layer should hold either a configurable activation quantizer, if it is quantized with mixed precision,
|
@@ -151,6 +151,7 @@ class MixedPrecisionPyTorchModelBuilder(PyTorchModelBuilder):
|
|
151
151
|
|
152
152
|
Args:
|
153
153
|
n: Node to get PytorchActivationQuantizationHolder to attach in its output.
|
154
|
+
holder_type: The type of the activation quantization holder to use.
|
154
155
|
|
155
156
|
Returns:
|
156
157
|
A PytorchActivationQuantizationHolder layer for the node activation quantization.
|
@@ -192,7 +193,7 @@ class MixedPrecisionPyTorchModelBuilder(PyTorchModelBuilder):
|
|
192
193
|
# thus we make sure this is the only possible case (unless it's a node with no activation
|
193
194
|
# quantization, which in this case has an empty list).
|
194
195
|
if len(activation_quantizers) == 1:
|
195
|
-
return
|
196
|
+
return holder_type(activation_quantizers[0])
|
196
197
|
|
197
198
|
Logger.critical(f"PytorchActivationQuantizationHolder expects a single quantizer, but ({len(activation_quantizers)}) quantizers were found for node {n}.")# pragma: no cover
|
198
199
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2025 Sony Semiconductor Israel, Inc. All rights reserved.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -34,7 +34,7 @@ from model_compression_toolkit.core.pytorch.default_framework_info import DEFAUL
|
|
34
34
|
from model_compression_toolkit.core.pytorch.reader.node_holders import DummyPlaceHolder
|
35
35
|
from model_compression_toolkit.core.pytorch.utils import to_torch_tensor
|
36
36
|
from mct_quantizers.common.constants import ACTIVATION_HOLDER_QUANTIZER
|
37
|
-
from mct_quantizers import PytorchQuantizationWrapper
|
37
|
+
from mct_quantizers import PytorchQuantizationWrapper, PytorchActivationQuantizationHolder, PytorchPreservingActivationQuantizationHolder
|
38
38
|
|
39
39
|
|
40
40
|
def _build_input_tensors_list(node: BaseNode,
|
@@ -332,13 +332,21 @@ class PytorchModel(torch.nn.Module):
|
|
332
332
|
else:
|
333
333
|
self.add_module(node.name, node_op)
|
334
334
|
|
335
|
-
|
336
|
-
if
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
335
|
+
activation_quantizer_holder = None
|
336
|
+
if self.use_activation_holder_during_model_building:
|
337
|
+
if node.is_activation_quantization_enabled():
|
338
|
+
activation_quantizer_holder = self.get_activation_quantizer_holder(node, holder_type=PytorchActivationQuantizationHolder)
|
339
|
+
|
340
|
+
elif node.is_quantization_preserving():
|
341
|
+
prev_node = self.graph.retrieve_preserved_quantization_node(node)
|
342
|
+
if prev_node.is_activation_quantization_enabled():
|
343
|
+
activation_quantizer_holder = self.get_activation_quantizer_holder(prev_node, holder_type=PytorchPreservingActivationQuantizationHolder)
|
344
|
+
|
345
|
+
if activation_quantizer_holder is not None:
|
346
|
+
activation_quantizer_holder_name = node.name + '_' + ACTIVATION_HOLDER_QUANTIZER
|
347
|
+
self.add_module(activation_quantizer_holder_name, activation_quantizer_holder)
|
348
|
+
self.node_to_activation_quantization_holder.update(
|
349
|
+
{node.name: activation_quantizer_holder_name})
|
342
350
|
|
343
351
|
def forward(self,
|
344
352
|
*args: Any) -> Any:
|
@@ -23,7 +23,7 @@ from model_compression_toolkit.logger import Logger
|
|
23
23
|
from model_compression_toolkit.core.common import Graph
|
24
24
|
from model_compression_toolkit.core.pytorch.reader.graph_builders import edges_builder, nodes_builder
|
25
25
|
from model_compression_toolkit.core.pytorch.utils import set_model
|
26
|
-
from
|
26
|
+
from edgemdt_cl.pytorch import CustomLayer
|
27
27
|
|
28
28
|
|
29
29
|
def _trace_model(root: Union[torch.nn.Module, Callable[..., Any]]) -> GraphModule:
|
model_compression_toolkit/exporter/model_exporter/pytorch/fakely_quant_onnx_pytorch_exporter.py
CHANGED
@@ -18,6 +18,8 @@ from io import BytesIO
|
|
18
18
|
import torch.nn
|
19
19
|
|
20
20
|
from mct_quantizers import PytorchActivationQuantizationHolder, PytorchQuantizationWrapper
|
21
|
+
|
22
|
+
from model_compression_toolkit.core.pytorch.reader.node_holders import DummyPlaceHolder
|
21
23
|
from model_compression_toolkit.verify_packages import FOUND_ONNX
|
22
24
|
from model_compression_toolkit.logger import Logger
|
23
25
|
from model_compression_toolkit.core.pytorch.utils import to_torch_tensor
|
@@ -98,15 +100,16 @@ if FOUND_ONNX:
|
|
98
100
|
model_output = self.model(*model_input) if isinstance(model_input, (list, tuple)) else self.model(
|
99
101
|
model_input)
|
100
102
|
|
103
|
+
input_names = [f"input_{i}" for i in range(len(model_input))] if len(model_input) > 1 else ["input"]
|
104
|
+
dynamic_axes = {name: {0: 'batch_size'} for name in input_names}
|
101
105
|
if output_names is None:
|
102
106
|
# Determine number of outputs and prepare output_names and dynamic_axes
|
103
107
|
if isinstance(model_output, (list, tuple)):
|
104
108
|
output_names = [f"output_{i}" for i in range(len(model_output))]
|
105
|
-
dynamic_axes = {'input': {0: 'batch_size'}}
|
106
109
|
dynamic_axes.update({name: {0: 'batch_size'} for name in output_names})
|
107
110
|
else:
|
108
111
|
output_names = ['output']
|
109
|
-
dynamic_axes
|
112
|
+
dynamic_axes.update({'output': {0: 'batch_size'}})
|
110
113
|
else:
|
111
114
|
if isinstance(model_output, (list, tuple)):
|
112
115
|
num_of_outputs = len(model_output)
|
@@ -115,9 +118,7 @@ if FOUND_ONNX:
|
|
115
118
|
assert len(output_names) == num_of_outputs, (f"Mismatch between number of requested output names "
|
116
119
|
f"({output_names}) and model output count "
|
117
120
|
f"({num_of_outputs}):\n")
|
118
|
-
dynamic_axes = {'input': {0: 'batch_size'}}
|
119
121
|
dynamic_axes.update({name: {0: 'batch_size'} for name in output_names})
|
120
|
-
|
121
122
|
if hasattr(self.model, 'metadata'):
|
122
123
|
onnx_bytes = BytesIO()
|
123
124
|
torch.onnx.export(self.model,
|
@@ -125,7 +126,7 @@ if FOUND_ONNX:
|
|
125
126
|
onnx_bytes,
|
126
127
|
opset_version=self._onnx_opset_version,
|
127
128
|
verbose=False,
|
128
|
-
input_names=
|
129
|
+
input_names=input_names,
|
129
130
|
output_names=output_names,
|
130
131
|
dynamic_axes=dynamic_axes)
|
131
132
|
onnx_model = onnx.load_from_string(onnx_bytes.getvalue())
|
@@ -137,7 +138,7 @@ if FOUND_ONNX:
|
|
137
138
|
self.save_model_path,
|
138
139
|
opset_version=self._onnx_opset_version,
|
139
140
|
verbose=False,
|
140
|
-
input_names=
|
141
|
+
input_names=input_names,
|
141
142
|
output_names=output_names,
|
142
143
|
dynamic_axes=dynamic_axes)
|
143
144
|
|
@@ -13,6 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
# ==============================================================================
|
15
15
|
from typing import Callable
|
16
|
+
from packaging import version
|
16
17
|
|
17
18
|
from model_compression_toolkit.verify_packages import FOUND_TORCH
|
18
19
|
from model_compression_toolkit.exporter.model_exporter.fw_agonstic.quantization_format import QuantizationFormat
|
@@ -30,6 +31,9 @@ if FOUND_TORCH:
|
|
30
31
|
from model_compression_toolkit.exporter.model_exporter.pytorch.fakely_quant_torchscript_pytorch_exporter import FakelyQuantTorchScriptPyTorchExporter
|
31
32
|
from model_compression_toolkit.exporter.model_wrapper.pytorch.validate_layer import is_pytorch_layer_exportable
|
32
33
|
|
34
|
+
if version.parse(torch.__version__) >= version.parse("2.4"):
|
35
|
+
DEFAULT_ONNX_OPSET_VERSION = 20
|
36
|
+
|
33
37
|
supported_serialization_quantization_export_dict = {
|
34
38
|
PytorchExportSerializationFormat.TORCHSCRIPT: [QuantizationFormat.FAKELY_QUANT],
|
35
39
|
PytorchExportSerializationFormat.ONNX: [QuantizationFormat.FAKELY_QUANT, QuantizationFormat.MCTQ]
|
model_compression_toolkit/exporter/model_wrapper/pytorch/builder/fully_quantized_model_builder.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2025 Sony Semiconductor Israel, Inc. All rights reserved.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -23,7 +23,7 @@ import model_compression_toolkit.core as C
|
|
23
23
|
|
24
24
|
if FOUND_TORCH:
|
25
25
|
import torch
|
26
|
-
from mct_quantizers import PytorchQuantizationWrapper, PytorchActivationQuantizationHolder
|
26
|
+
from mct_quantizers import PytorchQuantizationWrapper, PytorchActivationQuantizationHolder, PytorchPreservingActivationQuantizationHolder
|
27
27
|
from mct_quantizers.common.constants import OP_CALL_ARGS, OP_CALL_KWARGS
|
28
28
|
from model_compression_toolkit.core.pytorch.back2framework.pytorch_model_builder import PyTorchModelBuilder
|
29
29
|
from model_compression_toolkit.core.common.graph.functional_node import FunctionalNode
|
@@ -65,22 +65,26 @@ if FOUND_TORCH:
|
|
65
65
|
return module
|
66
66
|
|
67
67
|
|
68
|
-
def get_activation_quantizer_holder(node: BaseNode, fw_impl) -> Callable:
|
68
|
+
def get_activation_quantizer_holder(node: BaseNode, holder_type: PytorchActivationQuantizationHolder, fw_impl) -> Callable:
|
69
69
|
"""
|
70
70
|
Retrieve a PytorchActivationQuantizationHolder layer to use for activation quantization of a node.
|
71
71
|
If the layer is not supposed to be wrapped with an activation quantizer - return None.
|
72
72
|
Args:
|
73
73
|
node: Node to attach a PytorchActivationQuantizationHolder to its output.
|
74
|
+
holder_type: The type of the activation quantization holder to use.
|
74
75
|
fw_impl: FrameworkImplementation object with a specific framework methods implementation.
|
75
76
|
Returns:
|
76
77
|
A PytorchActivationQuantizationHolder module for the node's activation quantization.
|
77
78
|
"""
|
78
|
-
_, activation_quantizers = fw_impl.get_inferable_quantizers(node)
|
79
79
|
# Holder by definition uses a single quantizer for the activation quantization
|
80
80
|
# thus we make sure this is the only possible case (unless it's a node we no activation
|
81
81
|
# quantization, which in this case has an empty list).
|
82
|
+
_, activation_quantizers = fw_impl.get_inferable_quantizers(node)
|
82
83
|
if len(activation_quantizers) == 1:
|
83
|
-
|
84
|
+
if holder_type == PytorchActivationQuantizationHolder:
|
85
|
+
return holder_type(activation_quantizers[0])
|
86
|
+
elif holder_type == PytorchPreservingActivationQuantizationHolder:
|
87
|
+
return holder_type(activation_quantizers[0], quantization_bypass=True)
|
84
88
|
Logger.critical(
|
85
89
|
f'PytorchActivationQuantizationHolder supports a single quantizer but {len(activation_quantizers)} quantizers '
|
86
90
|
f'were found for node {node}')
|
@@ -96,13 +100,14 @@ if FOUND_TORCH:
|
|
96
100
|
Returns:
|
97
101
|
Fully quantized PyTorch model.
|
98
102
|
"""
|
103
|
+
fw_impl = C.pytorch.pytorch_implementation.PytorchImplementation()
|
99
104
|
exportable_model, user_info = PyTorchModelBuilder(graph=graph,
|
100
105
|
wrapper=lambda n, m:
|
101
106
|
fully_quantized_wrapper(n, m,
|
102
|
-
fw_impl=
|
103
|
-
get_activation_quantizer_holder_fn=lambda n:
|
104
|
-
get_activation_quantizer_holder(n,
|
105
|
-
fw_impl=
|
107
|
+
fw_impl=fw_impl),
|
108
|
+
get_activation_quantizer_holder_fn=lambda n, holder_type:
|
109
|
+
get_activation_quantizer_holder(n, holder_type,
|
110
|
+
fw_impl=fw_impl)).build_model()
|
106
111
|
|
107
112
|
Logger.info("\nPlease run your accuracy evaluation on the exported quantized model to verify it's accuracy.\n"
|
108
113
|
"Checkout the FAQ and Troubleshooting pages for resolving common issues and improving the quantized model accuracy:\n"
|
@@ -197,11 +197,12 @@ class PytorchGPTQTrainer(GPTQTrainer):
|
|
197
197
|
# quantized, do we need to wrap them as well?
|
198
198
|
return layer
|
199
199
|
|
200
|
-
def get_activation_quantizer_holder(self, n: BaseNode) -> Callable:
|
200
|
+
def get_activation_quantizer_holder(self, n: BaseNode, holder_type: PytorchActivationQuantizationHolder = PytorchActivationQuantizationHolder) -> Callable:
|
201
201
|
"""
|
202
202
|
Retrieve a PytorchActivationQuantizationHolder layer to use for activation quantization of a node.
|
203
203
|
Args:
|
204
204
|
n: Node to attach a PytorchActivationQuantizationHolder to its output.
|
205
|
+
holder_type: The type of the activation quantization holder to use.
|
205
206
|
Returns:
|
206
207
|
A PytorchActivationQuantizationHolder module for the node's activation quantization.
|
207
208
|
"""
|
@@ -213,7 +214,7 @@ class PytorchGPTQTrainer(GPTQTrainer):
|
|
213
214
|
f"but {len(activation_quantizers)} were found for node {n.name}. "
|
214
215
|
f"Ensure the node is configured with a single activation quantizer.")
|
215
216
|
quantizer = self.gradual_act_quantizer_wrapper_factory(activation_quantizers[0])
|
216
|
-
return
|
217
|
+
return holder_type(quantizer)
|
217
218
|
|
218
219
|
def build_gptq_model(self):
|
219
220
|
"""
|
@@ -30,7 +30,7 @@ from model_compression_toolkit.trainable_infrastructure.pytorch.activation_quant
|
|
30
30
|
|
31
31
|
|
32
32
|
def get_activation_quantizer_holder(n: common.BaseNode,
|
33
|
-
qat_config: QATConfig) -> Callable:
|
33
|
+
qat_config: QATConfig, holder_type: PytorchActivationQuantizationHolder = PytorchActivationQuantizationHolder) -> Callable:
|
34
34
|
"""
|
35
35
|
Retrieve a ActivationQuantizationHolder layer to use for activation quantization for a node.
|
36
36
|
If the layer is not supposed to be wrapped with activation quantizers - return None.
|
@@ -38,6 +38,7 @@ def get_activation_quantizer_holder(n: common.BaseNode,
|
|
38
38
|
Args:
|
39
39
|
n: Node for which to retrieve anActivationQuantizationHolder to attach to its output.
|
40
40
|
qat_config: QAT configuration (for example, training methods).
|
41
|
+
holder_type: The type of the activation quantization holder to use.
|
41
42
|
|
42
43
|
Returns:
|
43
44
|
A ActivationQuantizationHolder layer for the node's activation quantization.
|
@@ -49,7 +50,7 @@ def get_activation_quantizer_holder(n: common.BaseNode,
|
|
49
50
|
# thus we make sure this is the only possible case (unless it's a node with no activation
|
50
51
|
# quantization, which in this case has an empty list).
|
51
52
|
if len(activation_quantizers) == 1:
|
52
|
-
return
|
53
|
+
return holder_type(activation_quantizers[0])
|
53
54
|
Logger.critical(f'ActivationQuantizationHolder supports only a single quantizer, but ({len(activation_quantizers)}) quantizers were found for node {n}.')
|
54
55
|
|
55
56
|
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2keras.py
CHANGED
@@ -20,7 +20,7 @@ from model_compression_toolkit.target_platform_capabilities.targetplatform2frame
|
|
20
20
|
from model_compression_toolkit.target_platform_capabilities.targetplatform2framework.attach2fw import \
|
21
21
|
AttachTpcToFramework
|
22
22
|
|
23
|
-
from
|
23
|
+
from edgemdt_cl.keras.object_detection.ssd_post_process import SSDPostProcess
|
24
24
|
|
25
25
|
if version.parse(tf.__version__) >= version.parse("2.13"):
|
26
26
|
from keras.src.layers import Conv2D, DepthwiseConv2D, Dense, Reshape, ZeroPadding2D, Dropout, \
|
model_compression_toolkit/target_platform_capabilities/targetplatform2framework/attach2pytorch.py
CHANGED
@@ -32,7 +32,7 @@ from model_compression_toolkit.target_platform_capabilities.targetplatform2frame
|
|
32
32
|
from model_compression_toolkit.target_platform_capabilities.targetplatform2framework.attach2fw import \
|
33
33
|
AttachTpcToFramework
|
34
34
|
from model_compression_toolkit.target_platform_capabilities.targetplatform2framework.attribute_filter import Eq
|
35
|
-
from
|
35
|
+
from edgemdt_cl.pytorch import MulticlassNMS, MulticlassNMSWithIndices
|
36
36
|
|
37
37
|
|
38
38
|
class AttachTpcToPytorch(AttachTpcToFramework):
|
File without changes
|
File without changes
|
{mct_nightly-2.3.0.20250507.555.dist-info → mct_nightly-2.3.0.20250509.604.dist-info}/top_level.txt
RENAMED
File without changes
|