You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/int8/ptq/README.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@
4
4
5
5
Post Training Quantization (PTQ) is a technique to reduce the required computational resources for inference while still preserving the accuracy of your model by mapping the traditional FP32 activation space to a reduced INT8 space. TensorRT uses a calibration step which executes your model with sample data from the target domain and track the activations in FP32 to calibrate a mapping to INT8 that minimizes the information loss between FP32 inference and INT8 inference.
6
6
7
-
Users writing TensorRT applications are required to setup a calibrator class which will provide sample data to the TensorRT calibrator. With TRTorch we look to leverage existing infrastructure in PyTorch to make implementing calibrators easier.
7
+
Users writing TensorRT applications are required to setup a calibrator class which will provide sample data to the TensorRT calibrator. With Torch-TensorRT we look to leverage existing infrastructure in PyTorch to make implementing calibrators easier.
8
8
9
-
LibTorch provides a `Dataloader` and `Dataset` API which steamlines preprocessing and batching input data. TRTorch uses Dataloaders as the base of a generic calibrator implementation. So you will be able to reuse or quickly implement a `torch::Dataset` for your target domain, place it in a Dataloader and create a INT8 Calibrator from it which you can provide to TRTorch to run INT8 Calibration during compliation of your module.
9
+
LibTorch provides a `Dataloader` and `Dataset` API which steamlines preprocessing and batching input data. Torch-TensorRT uses Dataloaders as the base of a generic calibrator implementation. So you will be able to reuse or quickly implement a `torch::Dataset` for your target domain, place it in a Dataloader and create a INT8 Calibrator from it which you can provide to Torch-TensorRT to run INT8 Calibration during compliation of your module.
10
10
11
11
### Code
12
12
@@ -115,7 +115,7 @@ From here not much changes in terms of how to execution works. You are still abl
115
115
116
116
## Running the Example Application
117
117
118
-
This is a short example application that shows how to use TRTorch to perform post-training quantization for a module.
118
+
This is a short example application that shows how to use Torch-TensorRT to perform post-training quantization for a module.
119
119
120
120
## Prerequisites
121
121
@@ -139,11 +139,11 @@ This will build a binary named `ptq` in `bazel-out/k8-<opt|dbg>/bin/cpp/int8/ptq
139
139
140
140
## Compilation using Makefile
141
141
142
-
1) Download releases of <ahref="https://pytorch.org">LibTorch</a>, <ahref="https://github.com/NVIDIA/TRTorch/releases">TRTorch </a>and <ahref="https://developer.nvidia.com/nvidia-tensorrt-download">TensorRT</a> and unpack them in the deps directory.
142
+
1) Download releases of <ahref="https://pytorch.org">LibTorch</a>, <ahref="https://github.com/NVIDIA/Torch-TensorRT/releases">Torch-TensorRT </a>and <ahref="https://developer.nvidia.com/nvidia-tensorrt-download">TensorRT</a> and unpack them in the deps directory.
143
143
144
144
```sh
145
145
cd examples/torch_tensorrtrt_example/deps
146
-
# Download latest TRTorch release tar file (libtorch_tensorrt.tar.gz) from https://github.com/NVIDIA/TRTorch/releases
146
+
# Download latest Torch-TensorRT release tar file (libtorch_tensorrt.tar.gz) from https://github.com/NVIDIA/Torch-TensorRT/releases
We import header files `cifar10.h` and `benchmark.h` from `ROOT_DIR`. `ROOT_DIR` should point to the path where TRTorch is located `<path_to_TRTORCH>`.
164
+
We import header files `cifar10.h` and `benchmark.h` from `ROOT_DIR`. `ROOT_DIR` should point to the path where Torch-TensorRT is located `<path_to_TRTORCH>`.
165
165
166
-
By default it is set to `../../../`. If your TRTorch directory structure is different, please set `ROOT_DIR` accordingly.
166
+
By default it is set to `../../../`. If your Torch-TensorRT directory structure is different, please set `ROOT_DIR` accordingly.
We import header files `cifar10.h` and `benchmark.h` from `ROOT_DIR`. `ROOT_DIR` should point to the path where Torch-TensorRT is located `<path_to_TRTORCH>`.
58
+
We import header files `cifar10.h` and `benchmark.h` from `ROOT_DIR`. `ROOT_DIR` should point to the path where Torch-TensorRT is located `<path_to_torch_tensorrt>`.
59
59
60
60
By default it is set to `../../../`. If your Torch-TensorRT directory structure is different, please set `ROOT_DIR` accordingly.
Copy file name to clipboardExpand all lines: examples/int8/training/vgg16/finetune_qat.py
+1-1
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@
21
21
22
22
fromvgg16importvgg16
23
23
24
-
PARSER=argparse.ArgumentParser(description="VGG16 example to use with TRTorch PTQ")
24
+
PARSER=argparse.ArgumentParser(description="VGG16 example to use with Torch-TensorRT PTQ")
25
25
PARSER.add_argument('--epochs', default=100, type=int, help="Number of total epochs to train")
26
26
PARSER.add_argument('--enable_qat', action="store_true", help="Enable quantization aware training. This is recommended to perform on a pre-trained model.")
27
27
PARSER.add_argument('--batch-size', default=128, type=int, help="Batch size to use when training")
0 commit comments