{"id":45630,"library":"nvidia-modelopt-core","title":"NVIDIA TensorRT Model Optimizer Core","description":"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.","status":"active","version":"0.33.1","language":"python","source_language":"en","source_url":"https://github.com/NVIDIA/TensorRT-Model-Optimizer","tags":["model-optimization","quantization","tensorrt","pruning","distillation"],"install":[{"cmd":"pip install nvidia-modelopt-core","lang":"bash","label":"Default installation"},{"cmd":"pip install nvidia-modelopt-core[all]","lang":"bash","label":"Install with all extras (torch, onnx, etc.)"}],"dependencies":[{"reason":"Required for PyTorch model optimization workflows","package":"torch","optional":true},{"reason":"Required for ONNX model support","package":"onnx","optional":true},{"reason":"Required for TensorRT engine building and inference","package":"tensorrt","optional":true}],"imports":[{"wrong":"from modelopt.torch.opt import ModelOptTorchModel","symbol":"ModelOptTorchModel","correct":"from modelopt_core.torch.opt import ModelOptTorchModel"}],"quickstart":{"code":"import torch\nimport modelopt.torch as mt\n\n# Load a pretrained model (e.g., resnet50)\nmodel = torch.hub.load('pytorch/vision:v0.10.0', 'resnet50', pretrained=True)\n\n# Apply INT8 PTQ (requires calibration data)\n# For demonstration, we skip calibration and just show the pattern\n# quantized_model = mt.quantization.quantize(model, mode='int8', calibrator='max')\n\nprint('Model optimization scaffold ready')","lang":"python","description":"Basic scaffold to apply INT8 quantization to a PyTorch model. Replace with actual calibration data."},"warnings":[{"fix":"Uninstall `nvidia-modelopt` and install `nvidia-modelopt-core`. Update imports to use `modelopt.*` instead of `nvidia_modelopt.*`.","message":"The 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.","severity":"breaking","affected_versions":">=0.33.0"},{"fix":"Assign the return value: `quantized_model = quantize(model, ...)`.","message":"The `modelopt.torch.quantization.quantize` function returns a new model object; the original model is not modified in-place.","severity":"gotcha","affected_versions":"All"},{"fix":"Use `modelopt.torch.sparsity` instead of `modelopt.torch.pruning`.","message":"The `modelopt.torch.pruning` module is deprecated in favor of `modelopt.torch.sparsity` for pruning workflows as of v0.30.0.","severity":"deprecated","affected_versions":">=0.30.0"},{"fix":"When exporting to ONNX, set `opset_version=17` in `torch.onnx.export`.","message":"TensorRT export (`modelopt.onnx.export`) requires ONNX opset >=17 and may fail with older opsets. Ensure your model is exported with opset 17 or later.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'3.10':44 '3.12':45 'across':21 'activ':39 'approxim':49 'cadenc':47 'core':5 'deploy':20 'distil':29,57 'export':32 'gpus':23 'librari':37 'maintain':40 'model':3,9,17,52 'model-optim':51 'modelopt':11 'month':50 'nvidia':1,7,22 'optim':4,10,18,53 'provid':12 'prune':28,56 'ptq':26 'python':43 'qat':27 'quantiz':25,54 'releas':46 'support':24 'target':42 'tensorrt':2,8,31,55 'toolkit':15 'unifi':14 'v0.33.1':35","created_at":"2026-06-07T12:55:57.239614+00:00","updated_at":"2026-06-07T12:55:57.239614+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'modelopt_core.torch.opt'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/NVIDIA/TensorRT-Model-Optimizer","github":"https://github.com/NVIDIA/TensorRT-Model-Optimizer","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}