diff --git a/cpp/include/torch_tensorrt/ptq.h b/cpp/include/torch_tensorrt/ptq.h index 6650f45fe9..50f63f88db 100644 --- a/cpp/include/torch_tensorrt/ptq.h +++ b/cpp/include/torch_tensorrt/ptq.h @@ -59,7 +59,7 @@ class Int8Calibrator : Algorithm { * calibration cache * @param use_cache : bool - Whether to use the cache (if it exists) */ - Int8Calibrator(DataLoaderUniquePtr dataloader, const std::string& cache_file_path, bool use_cache) + Int8Calibrator(DataLoaderUniquePtr dataloader, const std::string& cache_file_path, bool use_cache) : dataloader_(dataloader.get()), cache_file_path_(cache_file_path), use_cache_(use_cache) { for (auto batch : *dataloader_) { batched_data_.push_back(batch.data); @@ -308,8 +308,8 @@ class Int8CacheCalibrator : Algorithm { * @param use_cache: bool - use calibration cache * @return Int8Calibrator */ - template +[[deprecated("Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details")]] inline Int8Calibrator make_int8_calibrator( DataLoader dataloader, const std::string& cache_file_path, @@ -344,6 +344,7 @@ inline Int8Calibrator make_int8_calibrator( * @return Int8CacheCalibrator */ template +[[deprecated("Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details")]] inline Int8CacheCalibrator make_int8_cache_calibrator(const std::string& cache_file_path) { return Int8CacheCalibrator(cache_file_path); } diff --git a/py/torch_tensorrt/ts/_compiler.py b/py/torch_tensorrt/ts/_compiler.py index 675c245ac8..691c9c9822 100644 --- a/py/torch_tensorrt/ts/_compiler.py +++ b/py/torch_tensorrt/ts/_compiler.py @@ -1,5 +1,6 @@ from __future__ import annotations +import warnings from typing import Any, List, Optional, Sequence, Set, Tuple import torch @@ -102,6 +103,10 @@ def compile( torch.jit.ScriptModule: Compiled TorchScript Module, when run it will execute via TensorRT """ + warnings.warn( + 'The torchscript frontend for Torch-TensorRT has been deprecated, please plan on porting to the dynamo frontend (torch_tensorrt.compile(..., ir="dynamo"). Torchscript will continue to be a supported deployment format via post compilation torchscript tracing, see: https://pytorch.org/TensorRT/user_guide/saving_models.html for more details' + ) + input_list = list(inputs) if inputs is not None else [] enabled_precisions_set = ( enabled_precisions if enabled_precisions is not None else set() @@ -240,6 +245,10 @@ def convert_method_to_trt_engine( Returns: bytes: Serialized TensorRT engine, can either be saved to a file or deserialized via TensorRT APIs """ + warnings.warn( + 'The torchscript frontend for Torch-TensorRT has been deprecated, please plan on porting to the dynamo frontend (torch_tensorrt.convert_method_to_trt_engine(..., ir="dynamo"). Torchscript will continue to be a supported deployment format via post compilation torchscript tracing, see: https://pytorch.org/TensorRT/user_guide/saving_models.html for more details' + ) + input_list = list(inputs) if inputs is not None else [] enabled_precisions_set = ( enabled_precisions if enabled_precisions is not None else {torch.float} diff --git a/py/torch_tensorrt/ts/ptq.py b/py/torch_tensorrt/ts/ptq.py index 6545de9674..5049ff4cdb 100644 --- a/py/torch_tensorrt/ts/ptq.py +++ b/py/torch_tensorrt/ts/ptq.py @@ -13,6 +13,8 @@ from torch_tensorrt import _C from torch_tensorrt.ts.logging import Level, log +import warnings + class CalibrationAlgo(Enum): ENTROPY_CALIBRATION = _C.CalibrationAlgo.ENTROPY_CALIBRATION @@ -88,6 +90,9 @@ def __init__(self, **kwargs: Any): pass def __new__(cls, *args: Any, **kwargs: Any) -> Self: + warnings.warn( + "Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details" + ) dataloader = args[0] algo_type = kwargs.get("algo_type", CalibrationAlgo.ENTROPY_CALIBRATION_2) cache_file = kwargs.get("cache_file", None) @@ -175,6 +180,9 @@ def __init__(self, **kwargs: Any): pass def __new__(cls, *args: Any, **kwargs: Any) -> Self: + warnings.warn( + "Int8 PTQ Calibrator has been deprecated by TensorRT, please plan on porting to a NVIDIA Model Optimizer Toolkit based workflow. See: https://pytorch.org/TensorRT/tutorials/_rendered_examples/dynamo/vgg16_ptq.html for more details" + ) cache_file = args[0] algo_type = kwargs.get("algo_type", CalibrationAlgo.ENTROPY_CALIBRATION_2)