mct-nightly 2.2.0.20241114.506__py3-none-any.whl → 2.2.0.20241115.526__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.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/METADATA +105 -58
- {mct_nightly-2.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/RECORD +6 -6
- model_compression_toolkit/__init__.py +1 -1
- {mct_nightly-2.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/LICENSE.md +0 -0
- {mct_nightly-2.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/WHEEL +0 -0
- {mct_nightly-2.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/top_level.txt +0 -0
{mct_nightly-2.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: mct-nightly
|
3
|
-
Version: 2.2.0.
|
3
|
+
Version: 2.2.0.20241115.526
|
4
4
|
Summary: A Model Compression Toolkit for neural networks
|
5
5
|
Home-page: UNKNOWN
|
6
6
|
License: UNKNOWN
|
@@ -25,69 +25,105 @@ Requires-Dist: scipy
|
|
25
25
|
Requires-Dist: protobuf
|
26
26
|
Requires-Dist: mct-quantizers==1.5.2
|
27
27
|
|
28
|
-
|
28
|
+
<div align="center" markdown="1">
|
29
|
+
<p>
|
30
|
+
<a href="https://sony.github.io/model_optimization/" target="_blank">
|
31
|
+
<img src="/docsrc/images/mctHeader-cropped.svg" width="1000"></a>
|
32
|
+
</p>
|
33
|
+
|
34
|
+
______________________________________________________________________
|
35
|
+
|
36
|
+
</div>
|
37
|
+
<div align="center">
|
38
|
+
<p align="center">
|
39
|
+
<a href="#getting-started">Getting Started</a> •
|
40
|
+
<a href="#tutorials-and-examples">Tutorials</a> •
|
41
|
+
<a href="#supported-features">High level features and techniques</a> •
|
42
|
+
<a href="#resources">Resources</a> •
|
43
|
+
<a href="#contributions">Community</a> •
|
44
|
+
<a href="#license">License</a>
|
45
|
+
</p>
|
46
|
+
<p align="center">
|
47
|
+
<a href="https://sony.github.io/model_optimization#prerequisites"><img src="https://img.shields.io/badge/pytorch-2.1%20%7C%202.2%20%7C%202.3-blue" /></a>
|
48
|
+
<a href="https://sony.github.io/model_optimization#prerequisites"><img src="https://img.shields.io/badge/TensorFlow-2.12%20%7C%202.13%20%7C%202.14%20%7C%202.15-blue" /></a>
|
49
|
+
<a href="https://sony.github.io/model_optimization#prerequisites"><img src="https://img.shields.io/badge/python-3.9%20%7C3.10%20%7C3.11-blue" /></a>
|
50
|
+
<a href="https://github.com/sony/model_optimization/releases"><img src="https://img.shields.io/github/v/release/sony/model_optimization" /></a>
|
51
|
+
<a href="https://github.com/sony/model_optimization/blob/main/LICENSE.md"><img src="https://img.shields.io/badge/license-Apache%202.0-blue" /></a>
|
52
|
+
|
53
|
+
</p>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
__________________________________________________________________________________________________________
|
29
57
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
58
|
+
## Getting Started
|
59
|
+
### Quick Installation
|
60
|
+
Pip install the model compression toolkit package in a Python>=3.9 environment with PyTorch>=2.1 or Tensorflow>=2.12.
|
61
|
+
```
|
62
|
+
pip install model-compression-toolkit
|
63
|
+
```
|
64
|
+
For installing the nightly version or installing from source, refer to the [installation guide](https://github.com/sony/model_optimization/blob/main/INSTALLATION.md).
|
35
65
|
|
36
|
-
|
66
|
+
**Important note**: In order to use MCT, you’ll need to provide a floating point .pt or .keras model as an input.
|
37
67
|
|
38
|
-
|
68
|
+
### Tutorials and Examples
|
39
69
|
|
70
|
+
Our [tutorials](https://github.com/sony/model_optimization/blob/main/tutorials/README.md) section will walk you through the basics of the MCT tool, covering various compression techniques for both Keras and PyTorch models.
|
71
|
+
Access interactive notebooks for hands-on learning with popular models/tasks or move on to [Resources](#resources) section.
|
40
72
|
|
73
|
+
### Supported Quantization Methods</div>
|
74
|
+
MCT supports various quantization methods as appears below.
|
75
|
+
<div align="center">
|
76
|
+
<p align="center">
|
41
77
|
|
42
|
-
|
78
|
+
Quantization Method | Complexity | Computational Cost | Tutorial
|
79
|
+
-------------------- | -----------|--------------------|---------
|
80
|
+
PTQ (Post Training Quantization) | Low | Low (~1-10 CPU minutes) | <a href="https://colab.research.google.com/github/sony/model_optimization/blob/main/tutorials/notebooks/mct_features_notebooks/pytorch/example_pytorch_post_training_quantization.ipynb"><img src="https://img.shields.io/badge/Pytorch-green"/></a> <a href="https://colab.research.google.com/github/sony/model_optimization/blob/main/tutorials/notebooks/mct_features_notebooks/keras/example_keras_post-training_quantization.ipynb"><img src="https://img.shields.io/badge/Keras-green"/></a>
|
81
|
+
GPTQ (parameters fine-tuning using gradients) | Moderate | Moderate (~1-3 GPU hours) | <a href="https://colab.research.google.com/github/sony/model_optimization/blob/main/tutorials/notebooks/mct_features_notebooks/pytorch/example_pytorch_mobilenet_gptq.ipynb"><img src="https://img.shields.io/badge/PyTorch-green"/></a> <a href="https://colab.research.google.com/github/sony/model_optimization/blob/main/tutorials/notebooks/mct_features_notebooks/keras/example_keras_mobilenet_gptq.ipynb"><img src="https://img.shields.io/badge/Keras-green"/></a>
|
82
|
+
QAT (Quantization Aware Training) | High | High (~12-36 GPU hours) | <a href="https://colab.research.google.com/github/sony/model_optimization/blob/main/tutorials/notebooks/mct_features_notebooks/keras/example_keras_qat.ipynb"><img src="https://img.shields.io/badge/Keras-green"/></a>
|
43
83
|
|
44
|
-
|
45
|
-
|
46
|
-
- [Results](https://github.com/sony/model_optimization?tab=readme-ov-file#results)
|
47
|
-
- [Troubleshooting](https://github.com/sony/model_optimization?tab=readme-ov-file#trouble-shooting)
|
48
|
-
- [Contributions](https://github.com/sony/model_optimization?tab=readme-ov-file#contributions)
|
49
|
-
- [License](https://github.com/sony/model_optimization?tab=readme-ov-file#license)
|
84
|
+
</p>
|
85
|
+
</div>
|
50
86
|
|
87
|
+
For each flow, **Quantization core** utilizes various algorithms and hyper-parameters for optimal [hardware-aware](https://github.com/sony/model_optimization/blob/main/model_compression_toolkit/target_platform_capabilities/README.md) quantization results.
|
88
|
+
For further details, please see [Supported features and algorithms](#supported-features).
|
51
89
|
|
52
|
-
|
90
|
+
Required input:
|
91
|
+
- Floating point model - 32bit model in either .pt or .keras format
|
92
|
+
- Representative dataset - can be either provided by the user, or generated utilizing the [Data Generation](#data-generation-) capability
|
53
93
|
|
54
|
-
|
94
|
+
<div align="center">
|
95
|
+
<p align="center">
|
55
96
|
|
56
|
-
|
97
|
+
<img src="/docsrc/images/mctDiagram_clean.svg" width="800">
|
98
|
+
</p>
|
99
|
+
</div>
|
57
100
|
|
58
|
-
|
59
|
-
|
60
|
-
pip install model-compression-toolkit
|
61
|
-
```
|
101
|
+
### Resources
|
102
|
+
* [User Guide](https://sony.github.io/model_optimization/docs/index.html) contains detailed information about MCT and guides you from installation through optimizing models for your edge AI applications.
|
62
103
|
|
63
|
-
|
104
|
+
* MCT's [API Docs](https://sony.github.io/model_optimization/docs/api/api_docs/) is seperated per quantization methods:
|
64
105
|
|
106
|
+
* [Post-training quantization](https://sony.github.io/model_optimization/docs/api/api_docs/index.html#ptq) | PTQ API docs
|
107
|
+
* [Gradient-based post-training quantization](https://sony.github.io/model_optimization/docs/api/api_docs/index.html#gptq) | GPTQ API docs
|
108
|
+
* [Quantization-aware training](https://sony.github.io/model_optimization/docs/api/api_docs/index.html#qat) | QAT API docs
|
65
109
|
|
66
|
-
|
110
|
+
* [Debug](https://sony.github.io/model_optimization/docs/guidelines/visualization.html) – modify optimization process or generate explainable report
|
67
111
|
|
68
|
-
|
69
|
-
covering compression techniques for Keras and PyTorch models. Access interactive [notebooks](https://github.com/sony/model_optimization/blob/main/tutorials/README.md)
|
70
|
-
for hands-on learning. For example:
|
71
|
-
* [Keras MobileNetV2 post training quantization](https://github.com/sony/model_optimization/blob/main/tutorials/notebooks/imx500_notebooks/keras/example_keras_mobilenetv2_for_imx500.ipynb)
|
72
|
-
* [Post training quantization with PyTorch](https://github.com/sony/model_optimization/blob/main/tutorials/notebooks/mct_features_notebooks/pytorch/example_pytorch_post_training_quantization.ipynb)
|
73
|
-
* [Data Generation for ResNet18 with PyTorch](https://github.com/sony/model_optimization/blob/main/tutorials/notebooks/mct_features_notebooks/pytorch/example_pytorch_data_generation.ipynb).
|
112
|
+
* [Release notes](https://github.com/sony/model_optimization/releases)
|
74
113
|
|
75
114
|
|
76
115
|
### Supported Versions
|
77
116
|
|
78
117
|
Currently, MCT is being tested on various Python, Pytorch and TensorFlow versions:
|
118
|
+
<details id="supported-versions">
|
119
|
+
<summary>Supported Versions Table</summary>
|
79
120
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
| Python 3.
|
84
|
-
| Python 3.
|
85
|
-
| Python 3.
|
86
|
-
| Python 3.12 | | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python312_pytorch22.yml) | [](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) |
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
121
|
+
| | PyTorch 2.2 | PyTorch 2.3 | PyTorch 2.4 | PyTorch 2.5 |
|
122
|
+
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
123
|
+
| Python 3.9 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python39_pytorch22.yml) | [](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) |
|
124
|
+
| Python 3.10 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_pytorch22.yml) | [](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) |
|
125
|
+
| Python 3.11 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_pytorch22.yml) | [](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) |
|
126
|
+
| Python 3.12 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python312_pytorch22.yml) | [](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) |
|
91
127
|
|
92
128
|
| | TensorFlow 2.12 | TensorFlow 2.13 | TensorFlow 2.14 | TensorFlow 2.15 |
|
93
129
|
|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
@@ -95,6 +131,7 @@ Currently, MCT is being tested on various Python, Pytorch and TensorFlow version
|
|
95
131
|
| Python 3.10 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_keras212.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_keras213.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_keras214.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python310_keras215.yml) |
|
96
132
|
| Python 3.11 | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_keras212.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_keras213.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_keras214.yml) | [](https://github.com/sony/model_optimization/actions/workflows/run_tests_python311_keras215.yml) |
|
97
133
|
|
134
|
+
</details>
|
98
135
|
|
99
136
|
## Supported Features
|
100
137
|
MCT offers a range of powerful features to optimize neural network models for efficient deployment. These supported features include:
|
@@ -112,9 +149,9 @@ MCT supports different quantization methods:
|
|
112
149
|
|
113
150
|
| Quantization Method | Complexity | Computational Cost |
|
114
151
|
|-----------------------------------------------|------------|-----------------------------|
|
115
|
-
| PTQ | Low | Low (
|
116
|
-
| GPTQ (parameters fine-tuning using gradients) |
|
117
|
-
| QAT | High | High (
|
152
|
+
| PTQ | Low | Low (~CPU minutes) |
|
153
|
+
| GPTQ (parameters fine-tuning using gradients) | Moderate | Moderate (~1-3 GPU hours) |
|
154
|
+
| QAT | High | High (~12-36 GPU hours) |
|
118
155
|
|
119
156
|
|
120
157
|
In addition, MCT supports different quantization schemes for quantizing weights and activations:
|
@@ -160,15 +197,14 @@ For more details, we highly recommend visiting our project website where experim
|
|
160
197
|
|
161
198
|
|
162
199
|
## Results
|
163
|
-
### Keras
|
164
|
-
Graph of [MobileNetV2](https://keras.io/api/applications/mobilenet/) accuracy on ImageNet vs average bit-width of weights, using
|
165
|
-
single-precision quantization, mixed-precision quantization, and mixed-precision quantization with GPTQ.
|
166
200
|
|
167
|
-
<
|
168
|
-
|
169
|
-
|
201
|
+
<p align="center">
|
202
|
+
<img src="/docsrc/images/Classification.png" width="225">
|
203
|
+
<img src="/docsrc/images/SemSeg.png" width="225">
|
204
|
+
<img src="/docsrc/images/PoseEst.png" width="225">
|
205
|
+
<img src="/docsrc/images/ObjDet.png" width="225">
|
170
206
|
|
171
|
-
### Pytorch
|
207
|
+
### Pytorch
|
172
208
|
We quantized classification networks from the torchvision library.
|
173
209
|
In the following table we present the ImageNet validation results for these models:
|
174
210
|
|
@@ -178,6 +214,14 @@ In the following table we present the ImageNet validation results for these mode
|
|
178
214
|
| ResNet-18 [3] | 69.86 | 69.63 |69.53|
|
179
215
|
| SqueezeNet 1.1 [3] | 58.128 | 57.678 ||
|
180
216
|
|
217
|
+
### Keras
|
218
|
+
MCT can quantize an existing 32-bit floating-point model to an 8-bit fixed-point (or less) model without compromising accuracy.
|
219
|
+
Below is a graph of [MobileNetV2](https://keras.io/api/applications/mobilenet/) accuracy on ImageNet vs average bit-width of weights (X-axis), using
|
220
|
+
single-precision quantization, mixed-precision quantization, and mixed-precision quantization with GPTQ.
|
221
|
+
|
222
|
+
<img src="https://github.com/sony/model_optimization/raw/main/docsrc/images/mbv2_accuracy_graph.png">
|
223
|
+
|
224
|
+
For more results, please see [1]
|
181
225
|
|
182
226
|
#### Pruning Results
|
183
227
|
|
@@ -188,23 +232,26 @@ Results for applying pruning to reduce the parameters of the following models by
|
|
188
232
|
| ResNet50 [2] | 75.1 | 72.4 |
|
189
233
|
| DenseNet121 [3] | 74.44 | 71.71 |
|
190
234
|
|
235
|
+
## Troubleshooting and Community
|
191
236
|
|
192
|
-
|
237
|
+
If you encountered large accuracy degradation with MCT, check out the [Quantization Troubleshooting](https://github.com/sony/model_optimization/tree/main/quantization_troubleshooting.md)
|
238
|
+
for common pitfalls and some tools to improve quantized model's accuracy.
|
193
239
|
|
194
|
-
|
195
|
-
for common pitfalls and some tools to improve quantization accuracy.
|
240
|
+
Check out the [FAQ](https://github.com/sony/model_optimization/tree/main/FAQ.md) for common issues.
|
196
241
|
|
197
|
-
|
242
|
+
You are welcome to ask questions and get support on our [issues section](https://github.com/sony/model_optimization/issues) and manage community discussions under [discussions section](https://github.com/sony/model_optimization/discussions).
|
198
243
|
|
199
244
|
|
200
245
|
## Contributions
|
201
246
|
MCT aims at keeping a more up-to-date fork and welcomes contributions from anyone.
|
202
247
|
|
203
|
-
*
|
248
|
+
*Checkout our [Contribution guide](https://github.com/sony/model_optimization/blob/main/CONTRIBUTING.md) for more details.
|
204
249
|
|
205
250
|
|
206
251
|
## License
|
207
|
-
|
252
|
+
MCT is licensed under Apache License Version 2.0. By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms.
|
253
|
+
|
254
|
+
<a href="https://github.com/sony/model_optimization/blob/main/LICENSE.md"><img src="https://img.shields.io/badge/license-Apache%202.0-blue" /></a>
|
208
255
|
|
209
256
|
## References
|
210
257
|
|
{mct_nightly-2.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/RECORD
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
model_compression_toolkit/__init__.py,sha256=
|
1
|
+
model_compression_toolkit/__init__.py,sha256=xJnRG_pdeNDYklohqX1vGwnTRflWUJChhOC0BYHv7FA,1573
|
2
2
|
model_compression_toolkit/constants.py,sha256=i4wYheBkIdQmsQA-axIpcT3YiSO1USNc-jaNiNE8w6E,3920
|
3
3
|
model_compression_toolkit/defaultdict.py,sha256=LSc-sbZYXENMCw3U9F4GiXuv67IKpdn0Qm7Fr11jy-4,2277
|
4
4
|
model_compression_toolkit/logger.py,sha256=3DByV41XHRR3kLTJNbpaMmikL8icd9e1N-nkQAY9oDk,4567
|
@@ -558,8 +558,8 @@ model_compression_toolkit/xquant/pytorch/model_analyzer.py,sha256=b93o800yVB3Z-i
|
|
558
558
|
model_compression_toolkit/xquant/pytorch/pytorch_report_utils.py,sha256=bOc-hFL3gdoSM1Th_S2N_-9JJSlPGpZCTx_QLJHS6lg,3388
|
559
559
|
model_compression_toolkit/xquant/pytorch/similarity_functions.py,sha256=CERxq5K8rqaiE-DlwhZBTUd9x69dtYJlkHOPLB54vm8,2354
|
560
560
|
model_compression_toolkit/xquant/pytorch/tensorboard_utils.py,sha256=mkoEktLFFHtEKzzFRn_jCnxjhJolK12TZ5AQeDHzUO8,9767
|
561
|
-
mct_nightly-2.2.0.
|
562
|
-
mct_nightly-2.2.0.
|
563
|
-
mct_nightly-2.2.0.
|
564
|
-
mct_nightly-2.2.0.
|
565
|
-
mct_nightly-2.2.0.
|
561
|
+
mct_nightly-2.2.0.20241115.526.dist-info/LICENSE.md,sha256=aYSSIb-5AFPeITTvXm1UAoe0uYBiMmSS8flvXaaFUks,10174
|
562
|
+
mct_nightly-2.2.0.20241115.526.dist-info/METADATA,sha256=34MNi8uWuXHKhogrWH98eeOKr1z8yka4dDR9ethdHzk,26007
|
563
|
+
mct_nightly-2.2.0.20241115.526.dist-info/WHEEL,sha256=bFJAMchF8aTQGUgMZzHJyDDMPTO3ToJ7x23SLJa1SVo,92
|
564
|
+
mct_nightly-2.2.0.20241115.526.dist-info/top_level.txt,sha256=gsYA8juk0Z-ZmQRKULkb3JLGdOdz8jW_cMRjisn9ga4,26
|
565
|
+
mct_nightly-2.2.0.20241115.526.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.2.0.
|
30
|
+
__version__ = "2.2.0.20241115.000526"
|
{mct_nightly-2.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/LICENSE.md
RENAMED
File without changes
|
File without changes
|
{mct_nightly-2.2.0.20241114.506.dist-info → mct_nightly-2.2.0.20241115.526.dist-info}/top_level.txt
RENAMED
File without changes
|