Registry / ai-ml / nvidia-modelopt-core

nvidia-modelopt-core

JSON →
library0.33.1pypypiunverified

The NVIDIA TensorRT Model Optimizer (ModelOpt) provides a unified toolkit for model optimization and deployment across NVIDIA GPUs, supporting quantization (PTQ, QAT), pruning, distillation, and TensorRT export. As of v0.33.1, the library is actively maintained and targets Python 3.10–3.12. Release cadence is approximately monthly.

pip install nvidia-modelopt-core
INSTALL
IMPORT
SIG · NVIDIA-MODELOPT-CO
N
nvidia-modelopt-core
ai-mlpythonv0.33.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

ModelOptTorchModel
from modelopt_core.torch.opt import ModelOptTorchModel
from modelopt.torch.opt import ModelOptTorchModel

Basic scaffold to apply INT8 quantization to a PyTorch model. Replace with actual calibration data.

import torch import modelopt.torch as mt # Load a pretrained model (e.g., resnet50) model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet50', pretrained=True) # Apply INT8 PTQ (requires calibration data) # For demonstration, we skip calibration and just show the pattern # quantized_model = mt.quantization.quantize(model, mode='int8', calibrator='max') print('Model optimization scaffold ready')
Debug
Known issues
breakingThe library was previously distributed as `nvidia-modelopt` (v0.x) and has been renamed to `nvidia-modelopt-core` starting with v0.33.0. The old package name is no longer updated and imports from `nvidia_modelopt` will fail.
fix
Uninstall `nvidia-modelopt` and install `nvidia-modelopt-core`. Update imports to use `modelopt.*` instead of `nvidia_modelopt.*`.
affects: >=0.33.0
gotchaThe `modelopt.torch.quantization.quantize` function returns a new model object; the original model is not modified in-place.
fix
Assign the return value: `quantized_model = quantize(model, ...)`.
affects: All
deprecatedThe `modelopt.torch.pruning` module is deprecated in favor of `modelopt.torch.sparsity` for pruning workflows as of v0.30.0.
fix
Use `modelopt.torch.sparsity` instead of `modelopt.torch.pruning`.
affects: >=0.30.0
gotchaTensorRT export (`modelopt.onnx.export`) requires ONNX opset >=17 and may fail with older opsets. Ensure your model is exported with opset 17 or later.
fix
When exporting to ONNX, set `opset_version=17` in `torch.onnx.export`.
affects: All
Upgrade
Version history
0.33.1latest on PyPI · released Aug 12, 2025
Audit
Dependencies
torchoptionalRequired for PyTorch model optimization workflows
onnxoptionalRequired for ONNX model support
tensorrtoptionalRequired for TensorRT engine building and inference
Agent activity
6 hits · last 30 days
node
6
Resources
nvidia-modelopt-core — pip install nvidia-modelopt-core · libregistry