Registry / ai-ml / model-compression-toolkit

model-compression-toolkit

JSON →
library2.6.0pypypiunverified

A Model Compression Toolkit (MCT) for neural networks, supporting quantization, pruning, and knowledge distillation. Current version is 2.6.0. Released monthly on PyPI.

pip install model-compression-toolkit
INSTALL
IMPORT
SIG · MODEL-COMPRESSION-
M
model-compression-toolkit
ai-mlpythonv2.6.0
Install
22.1s avg
Import
Disk
535MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 22.1s · import 0.000s · 516MB
535MB installed
● package 535MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytorch_post_training_quantization
from model_compression_toolkit import pytorch_post_training_quantization
import mct
MCT does not expose a top-level 'mct' module; import from package name with underscores.
ptq
from model_compression_toolkit import pytorch_post_training_quantization as ptq
from mct import ptq
Common mistake: using 'mct' alias which is not defined.

Basic post-training quantization on a PyTorch model using representative data.

import torch from model_compression_toolkit import pytorch_post_training_quantization as ptq tmodel = torch.nn.Linear(10, 5) tmodel.eval() representative_dataset = [torch.randn(1, 10) for _ in range(5)] quantized_model, quantization_info = ptq.pytorch_post_training_quantization( model=tmodel, representative_data_gen=representative_dataset, target_platform_name='default' ) print('Quantization completed, model size saved.')
mct --version
Debug
Known issues
breakingIn version 2.0+, the API changed from using `post_training_quantization` to `pytorch_post_training_quantization`. Old code will break.
fix
Update import to `from model_compression_toolkit import pytorch_post_training_quantization` and adjust function calls accordingly.
affects: <=1.x -> 2.0+
gotchaThe `model_compression_toolkit` package name uses underscores, but many users mistakenly import `mct`. The package does not provide a `mct` top-level module.
fix
Use correct import: `from model_compression_toolkit import ...`
affects: all
deprecatedThe `keras`-related interfaces (e.g., `keras_post_training_quantization`) are deprecated as of v2.6 and may be removed in future versions.
fix
Transition to the PyTorch or TensorFlow 2.x native API. Use `tensorflow_post_training_quantization` for TF2.
affects: >=2.6
Upgrade
Version history
2.6.0latest on PyPI · released Mar 4, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
model-compression-toolkit — pip install model-compression-toolkit · libregistry