Skip to content

Files

Latest commit

8c6d69d · Mar 11, 2025

History

History

pytorch-quantization

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 11, 2025
Mar 11, 2025
Mar 11, 2025
Apr 3, 2024
Mar 11, 2025
Oct 20, 2020
Oct 20, 2020
Oct 20, 2020
Oct 20, 2020
Jul 11, 2024
Oct 20, 2020
Oct 20, 2020
Mar 11, 2025
Jul 11, 2024
Feb 5, 2021
Oct 20, 2020
Apr 3, 2024

Note: Pytorch Quantization development has transitioned to the TensorRT Model Optimizer. All developers are encouraged to use the TensorRT Model Optimizer to benefit from the latest advancements on quantization and compression. While the Pytorch Quantization code will remain available, it will no longer receive further development.

Pytorch Quantization

PyTorch-Quantization is a toolkit for training and evaluating PyTorch models with simulated quantization. Quantization can be added to the model automatically, or manually, allowing the model to be tuned for accuracy and performance. Quantization is compatible with NVIDIAs high performance integer kernels which leverage integer Tensor Cores. The quantized model can be exported to ONNX and imported by TensorRT 8.0 and later.

Install

Binaries

pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com

From Source

git clone https://github.com/NVIDIA/TensorRT.git
cd tools/pytorch-quantization

Install PyTorch and prerequisites

pip install -r requirements.txt
# for CUDA 10.2 users
pip install torch>=1.9.1
# for CUDA 11.1 users
pip install torch>=1.9.1+cu111

Build and install pytorch-quantization

# Python version >= 3.7, GCC version >= 5.4 required
python setup.py install

NGC Container

pytorch-quantization is preinstalled in NVIDIA NGC PyTorch container, e.g. nvcr.io/nvidia/pytorch:22.12-py3

Resources