Skip to content

Commit 8d9722d

Browse files
committed
refactor! : Update README.md with the new library name Torch-TensorRT
Signed-off-by: Dheeraj Peri <[email protected]>
1 parent e5f96d9 commit 8d9722d

File tree

9 files changed

+108
-116
lines changed

9 files changed

+108
-116
lines changed

README.md

+29-30
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# TRTorch
1+
# Torch-TensorRT
22

3-
[![Documentation](https://img.shields.io/badge/docs-master-brightgreen)](https://nvidia.github.io/TRTorch/)
3+
[![Documentation](https://img.shields.io/badge/docs-master-brightgreen)](https://nvidia.github.io/Torch-TensorRT/)
44

55
> Ahead of Time (AOT) compiling for PyTorch JIT
66
7-
TRTorch is a compiler for PyTorch/TorchScript, targeting NVIDIA GPUs via NVIDIA's TensorRT Deep Learning Optimizer and Runtime. Unlike PyTorch's Just-In-Time (JIT) compiler, TRTorch is an Ahead-of-Time (AOT) compiler, meaning that before you deploy your TorchScript code, you go through an explicit compile step to convert a standard TorchScript program into an module targeting a TensorRT engine. TRTorch operates as a PyTorch extention and compiles modules that integrate into the JIT runtime seamlessly. After compilation using the optimized graph should feel no different than running a TorchScript module. You also have access to TensorRT's suite of configurations at compile time, so you are able to specify operating precision (FP32/FP16/INT8) and other settings for your module.
7+
Torch-TensorRT is a compiler for PyTorch/TorchScript, targeting NVIDIA GPUs via NVIDIA's TensorRT Deep Learning Optimizer and Runtime. Unlike PyTorch's Just-In-Time (JIT) compiler, Torch-TensorRT is an Ahead-of-Time (AOT) compiler, meaning that before you deploy your TorchScript code, you go through an explicit compile step to convert a standard TorchScript program into an module targeting a TensorRT engine. Torch-TensorRT operates as a PyTorch extention and compiles modules that integrate into the JIT runtime seamlessly. After compilation using the optimized graph should feel no different than running a TorchScript module. You also have access to TensorRT's suite of configurations at compile time, so you are able to specify operating precision (FP32/FP16/INT8) and other settings for your module.
88

99
More Information / System Architecture:
1010

@@ -15,18 +15,18 @@ More Information / System Architecture:
1515
### C++
1616
```c++
1717
#include "torch/script.h"
18-
#include "trtorch/trtorch.h"
18+
#include "torch_tensorrt/torch_tensorrt.h"
1919

2020
...
2121
// Set input datatypes. Allowerd options torch::{kFloat, kHalf, kChar, kInt32, kBool}
2222
// Size of input_dtypes should match number of inputs to the network.
2323
// If input_dtypes is not set, default precision follows traditional PyT / TRT rules
24-
auto input = trtorch::CompileSpec::Input(dims, torch::kHalf)
25-
auto compile_settings = trtorch::CompileSpec({input});
24+
auto input = torch_tensorrt::CompileSpec::Input(dims, torch::kHalf)
25+
auto compile_settings = torch_tensorrt::CompileSpec({input});
2626
// FP16 execution
2727
compile_settings.enabled_precisions = {torch::kHalf};
2828
// Compile module
29-
auto trt_mod = trtorch::CompileGraph(ts_mod, compile_settings);
29+
auto trt_mod = torch_tensorrt::CompileGraph(ts_mod, compile_settings);
3030
// Run like normal
3131
auto results = trt_mod.forward({in_tensor});
3232
// Save module for later
@@ -36,11 +36,11 @@ trt_mod.save("trt_torchscript_module.ts");
3636
3737
### Python
3838
```py
39-
import trtorch
39+
import torch_tensorrt
4040
4141
...
4242
compile_settings = {
43-
"inputs": [trtorch.Input(
43+
"inputs": [torch_tensorrt.Input(
4444
min_shape=[1, 3, 224, 224],
4545
opt_shape=[1, 3, 512, 512],
4646
max_shape=[1, 3, 1024, 1024],
@@ -50,7 +50,7 @@ compile_settings = {
5050
"enabled_precisions": {torch.half}, # Run with FP16
5151
}
5252
53-
trt_ts_module = trtorch.compile(torch_script_module, compile_settings)
53+
trt_ts_module = torch_tensorrt.compile(torch_script_module, compile_settings)
5454
5555
input_data = input_data.half()
5656
result = trt_ts_module(input_data)
@@ -75,7 +75,7 @@ torch.jit.save(trt_ts_module, "trt_torchscript_module.ts")
7575
> Note: Refer NVIDIA NGC container(https://ngc.nvidia.com/catalog/containers/nvidia:l4t-pytorch) for PyTorch libraries on JetPack.
7676
7777
### Dependencies
78-
These are the following dependencies used to verify the testcases. TRTorch can work with other versions, but the tests are not guaranteed to pass.
78+
These are the following dependencies used to verify the testcases. Torch-TensorRT can work with other versions, but the tests are not guaranteed to pass.
7979

8080
- Bazel 4.0.0
8181
- Libtorch 1.9.1 (built with CUDA 11.1)
@@ -85,9 +85,9 @@ These are the following dependencies used to verify the testcases. TRTorch can w
8585

8686
## Prebuilt Binaries and Wheel files
8787

88-
Releases: https://github.com/NVIDIA/TRTorch/releases
88+
Releases: https://github.com/NVIDIA/Torch-TensorRT/releases
8989

90-
## Compiling TRTorch
90+
## Compiling Torch-TensorRT
9191

9292
### Installing Dependencies
9393

@@ -113,17 +113,17 @@ then you have two options.
113113

114114
#### 1. Building using cuDNN & TensorRT tarball distributions
115115

116-
> This is recommended so as to build TRTorch hermetically and insures any bugs are not caused by version issues
116+
> This is recommended so as to build Torch-TensorRT hermetically and insures any bugs are not caused by version issues
117117
118-
> Make sure when running TRTorch that these versions of the libraries are prioritized in your `$LD_LIBRARY_PATH`
118+
> Make sure when running Torch-TensorRT that these versions of the libraries are prioritized in your `$LD_LIBRARY_PATH`
119119
120120
1. You need to download the tarball distributions of TensorRT and cuDNN from the NVIDIA website.
121121
- https://developer.nvidia.com/cudnn
122122
- https://developer.nvidia.com/tensorrt
123123
2. Place these files in a directory (the directories `third_party/dist_dir/[x86_64-linux-gnu | aarch64-linux-gnu]` exist for this purpose)
124124
3. Compile using:
125125
``` shell
126-
bazel build //:libtrtorch --compilation_mode opt --distdir third_party/dist_dir/[x86_64-linux-gnu | aarch64-linux-gnu]
126+
bazel build //:libtorchtrt --compilation_mode opt --distdir third_party/dist_dir/[x86_64-linux-gnu | aarch64-linux-gnu]
127127
```
128128

129129
#### 2. Building using locally installed cuDNN & TensorRT
@@ -170,30 +170,29 @@ new_local_repository(
170170
```
171171
3. Compile using:
172172
``` shell
173-
bazel build //:libtrtorch --compilation_mode opt
173+
bazel build //:libtorchtrt --compilation_mode opt
174174
```
175175

176176
### Debug build
177177
``` shell
178-
bazel build //:libtrtorch --compilation_mode=dbg
178+
bazel build //:libtorchtrt --compilation_mode=dbg
179179
```
180180

181181
### Native compilation on NVIDIA Jetson AGX
182182
``` shell
183-
bazel build //:libtrtorch --distdir third_party/dist_dir/aarch64-linux-gnu
183+
bazel build //:libtorchtrt --distdir third_party/dist_dir/aarch64-linux-gnu
184184
```
185185
> Note: Please refer [installation](docs/tutorials/installation.html) instructions for Pre-requisites
186186
187187
A tarball with the include files and library can then be found in bazel-bin
188188

189-
### Running TRTorch on a JIT Graph
189+
### Running Torch-TensorRT on a JIT Graph
190190

191191
> Make sure to add LibTorch to your LD_LIBRARY_PATH <br>
192-
>`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bazel-TRTorch/external/libtorch/lib`
193-
192+
>`export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bazel-Torch-TensorRT/external/libtorch/lib`
194193
195194
``` shell
196-
bazel run //cpp/trtorchexec -- $(realpath <PATH TO GRAPH>) <input-size>
195+
bazel run //cpp/bin/torchtrtc -- $(realpath <PATH TO GRAPH>) out.ts <input-size>
197196
```
198197

199198
## Compiling the Python Package
@@ -202,15 +201,15 @@ To compile the python package for your local machine, just run `python3 setup.py
202201
To build wheel files for different python versions, first build the Dockerfile in ``//py`` then run the following
203202
command
204203
```
205-
docker run -it -v$(pwd)/..:/workspace/TRTorch build_trtorch_wheel /bin/bash /workspace/TRTorch/py/build_whl.sh
204+
docker run -it -v$(pwd)/..:/workspace/Torch-TensorRT build_torch_tensorrt_wheel /bin/bash /workspace/Torch-TensorRT/py/build_whl.sh
206205
```
207206
Python compilation expects using the tarball based compilation strategy from above.
208207

209208
## How do I add support for a new op...
210209

211-
### In TRTorch?
210+
### In Torch-TensorRT?
212211

213-
Thanks for wanting to contribute! There are two main ways to handle supporting a new op. Either you can write a converter for the op from scratch and register it in the NodeConverterRegistry or if you can map the op to a set of ops that already have converters you can write a graph rewrite pass which will replace your new op with an equivalent subgraph of supported ops. Its preferred to use graph rewriting because then we do not need to maintain a large library of op converters. Also do look at the various op support trackers in the [issues](https://github.com/NVIDIA/TRTorch/issues) for information on the support status of various operators.
212+
Thanks for wanting to contribute! There are two main ways to handle supporting a new op. Either you can write a converter for the op from scratch and register it in the NodeConverterRegistry or if you can map the op to a set of ops that already have converters you can write a graph rewrite pass which will replace your new op with an equivalent subgraph of supported ops. Its preferred to use graph rewriting because then we do not need to maintain a large library of op converters. Also do look at the various op support trackers in the [issues](https://github.com/NVIDIA/Torch-TensorRT/issues) for information on the support status of various operators.
214213

215214
### In my application?
216215

@@ -224,9 +223,9 @@ You can register a converter for your op using the `NodeConverterRegistry` insid
224223
| ------------- | ------------------------------------------------------------ |
225224
| [**core**](core) | Main JIT ingest, lowering, conversion and runtime implementations |
226225
| [**cpp**](cpp) | C++ API and CLI source |
227-
| [**examples**](examples) | Example applications to show different features of TRTorch |
228-
| [**py**](py) | Python API for TRTorch |
229-
| [**tests**](tests) | Unit tests for TRTorch |
226+
| [**examples**](examples) | Example applications to show different features of Torch-TensorRT |
227+
| [**py**](py) | Python API for Torch-TensorRT |
228+
| [**tests**](tests) | Unit tests for Torch-TensorRT |
230229

231230
## Contributing
232231

@@ -235,4 +234,4 @@ Take a look at the [CONTRIBUTING.md](CONTRIBUTING.md)
235234

236235
## License
237236

238-
The TRTorch license can be found in the LICENSE file. It is licensed with a BSD Style licence
237+
The Torch-TensorRT license can be found in the LICENSE file. It is licensed with a BSD Style licence

core/README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# TRTorch Core
2-
The TRTorch Core is the main graph analysis library, it processes a TorchScript Module, converting method graphs to engines and returning a new equivalent module which when run will run inputs through a TensorRT engine
1+
# Torch-TensorRT Core
2+
The Torch-TensorRT Core is the main graph analysis library, it processes a TorchScript Module, converting method graphs to engines and returning a new equivalent module which when run will run inputs through a TensorRT engine
33

44
## Stages
55

6-
> Basic rule of thumb for organization, if the the output of the component is a modified block then it is in lowering, if the output is a TRT engine block then its in conversion
6+
> Basic rule of thumb for organization, if the the output of the component is a modified block then it is in lowering, if the output is a TRT engine block then its in conversion
77
88
## Lowering Passes
99

@@ -14,29 +14,29 @@ Firstly the graph will go through the lowering passes used in LibTorch, this wil
1414

1515
#### Call Method Insertions
1616

17-
Graphs from prim::CallMethods need to be inserted into the graph or used to segment the graph into convertible subgraphs.
17+
Graphs from prim::CallMethods need to be inserted into the graph or used to segment the graph into convertible subgraphs.
1818

19-
### TRTorch Lowering
19+
### Torch-TensorRT Lowering
2020

21-
To simplify conversion we can use the PyTorch JIT Subgraph Rewriter to simplify the set of subgraphs that need explicit TensorRT converters. This means we could aim for closer to 1->1 op conversion vs looking for applicable subgraphs, limit the number of converters and reduce the size of each converter.
21+
To simplify conversion we can use the PyTorch JIT Subgraph Rewriter to simplify the set of subgraphs that need explicit TensorRT converters. This means we could aim for closer to 1->1 op conversion vs looking for applicable subgraphs, limit the number of converters and reduce the size of each converter.
2222

2323

24-
## Conversion Phase
24+
## Conversion Phase
2525

26-
Once the graph has be simplified to a form thats easy to convert, we then set up a conversion context to manage the construction of a TensorRT INetworkDefinition from the blocks nodes. The conversion context records the set of converted nodes, block inputs and outputs and other information about the conversion of the graph. This data is then used to help converters link together layers and also hold build time information like weights required to construct the engine. After the context is created, the block converter starts iterating through the list of nodes, for each node, the converter will look at its inputs and assemble a dictionary of resources to pass to the converter. Inputs can be in a couple of states:
26+
Once the graph has be simplified to a form thats easy to convert, we then set up a conversion context to manage the construction of a TensorRT INetworkDefinition from the blocks nodes. The conversion context records the set of converted nodes, block inputs and outputs and other information about the conversion of the graph. This data is then used to help converters link together layers and also hold build time information like weights required to construct the engine. After the context is created, the block converter starts iterating through the list of nodes, for each node, the converter will look at its inputs and assemble a dictionary of resources to pass to the converter. Inputs can be in a couple of states:
2727
- The input is a block parameter
2828
In this case the input should have already been stored in as an IValue in the conversion context evaluated_value_map. The conversion stage will add the IValue to the list of args for the converter
2929
- The input is an output of a node that has already been converted
3030
In this case the ITensor of the output has added to the to the value_tensor_map, The conversion stage will add the ITensor to the list of args for the converter
3131
- The input is from a node that produces a static value
3232
There are nodes that produce static values, typically used to store parameters for operators, we need to evaluate these nodes at conversion time to be able to convert a op. The converter will look for a node evaluator in the evaluator registry and run it on the node. The IValue produced will be entered in the conversion context evaluated_value_map and added to the list of args for the converter.
33-
- The input is from a node that has not been converted
34-
TRTorch will error here
33+
- The input is from a node that has not been converted
34+
Torch-TensorRT will error here
3535

3636
### Node Evaluation
3737

38-
There are some nodes that contain static data and are resources for operations. These can be evaluated at conversion time so that you can use those values when doing node conversion. In theory any node kind can have a conversion time evaluator as long as it produces a static IValue, This IValue will be stored in the conversion context so it can be consumed by any node that takes the evaluated node as an input.
38+
There are some nodes that contain static data and are resources for operations. These can be evaluated at conversion time so that you can use those values when doing node conversion. In theory any node kind can have a conversion time evaluator as long as it produces a static IValue, This IValue will be stored in the conversion context so it can be consumed by any node that takes the evaluated node as an input.
3939

4040
### Converters
4141

42-
See the README in //core/conversion/converters for more information
42+
See the README in //core/conversion/converters for more information

core/conversion/evaluators/README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
Three types
2-
bool, int64_t, double
1+
# Evaluators
2+
3+
Operators whose outputs are known at compile time are considered to be evaluators. For example, in PyTorch library,
4+
operations like `aten::zeros`, `aten::full` are constants in the graph which can be expressed as constant values in TensorRT
5+
graph. Pytorch library expresses constants and new data structures using `aten` and `prim` libraries. Corresponding TensorRT
6+
implementations for such operators can be found in `aten.cpp` and `prim.cpp`.

core/plugins/README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# TRTorch Plugins
1+
# Torch-TensorRT Plugins
22

3-
A library for plugins (custom layers) used in a network. This component of TRTorch library builds a separate library called `libtrtorch_plugins.so`.
3+
A library for plugins (custom layers) used in a network. This component of Torch-TensorRT library builds a separate library called `libtorchtrt_plugins.so`.
44

5-
On a high level, TRTorch plugin library interface does the following :
5+
On a high level, Torch-TensorRT plugin library interface does the following :
66

77
- Uses TensorRT plugin registry as the main data structure to access all plugins.
88

99
- Automatically registers TensorRT plugins with empty namepsace.
1010

11-
- Automatically registers TRTorch plugins with `"trtorch"` namespace.
11+
- Automatically registers Torch-TensorRT plugins with `"torch_tensorrt"` namespace.
1212

1313
Here is the brief description of functionalities of each file
1414

15-
- `plugins.h` - Provides a macro to register any plugins with `"trtorch"` namespace.
16-
- `register_plugins.cpp` - Main registry class which initializes both `libnvinfer` plugins and TRTorch plugins (`Interpolate` and `Normalize`)
15+
- `plugins.h` - Provides a macro to register any plugins with `"torch_tensorrt"` namespace.
16+
- `register_plugins.cpp` - Main registry class which initializes both `libnvinfer` plugins and Torch-TensorRT plugins (`Interpolate` and `Normalize`)
1717
- `impl/interpolate_plugin.cpp` - Core implementation of interpolate plugin. Uses pytorch kernels during execution.
1818
- `impl/normalize_plugin.cpp` - Core implementation of normalize plugin. Uses pytorch kernels during execution.
1919

@@ -22,19 +22,19 @@ A converter basically converts a pytorch layer in the torchscript graph into a T
2222
We can access a plugin via the plugin name and namespace in which it is registered.
2323
For example, to access the Interpolate plugin, we can use
2424
```
25-
auto creator = getPluginRegistry()->getPluginCreator("Interpolate", "1", "trtorch");
25+
auto creator = getPluginRegistry()->getPluginCreator("Interpolate", "1", "torch_tensorrt");
2626
auto interpolate_plugin = creator->createPlugin(name, &fc); // fc is the collection of parameters passed to the plugin.
2727
```
2828

2929
### If you have your own plugin
3030

31-
If you'd like to compile your plugin with TRTorch,
31+
If you'd like to compile your plugin with Torch-TensorRT,
3232

3333
- Add your implementation to the `impl` directory
34-
- Add a call `REGISTER_TRTORCH_PLUGINS(MyPluginCreator)` to `register_plugins.cpp`. `MyPluginCreator` is the plugin creator class which creates your plugin. By adding this to `register_plugins.cpp`, your plugin will be initialized and accessible (added to TensorRT plugin registry) during the `libtrtorch_plugins.so` library loading.
34+
- Add a call `REGISTER_TRTORCH_PLUGINS(MyPluginCreator)` to `register_plugins.cpp`. `MyPluginCreator` is the plugin creator class which creates your plugin. By adding this to `register_plugins.cpp`, your plugin will be initialized and accessible (added to TensorRT plugin registry) during the `libtorchtrt_plugins.so` library loading.
3535
- Update the `BUILD` file with the your plugin files and dependencies.
3636
- Implement a converter op which makes use of your plugin.
3737

38-
Once you've completed the above steps, upon successful compilation of TRTorch library, your plugin should be available in `libtrtorch_plugins.so`.
38+
Once you've completed the above steps, upon successful compilation of Torch-TensorRT library, your plugin should be available in `libtorchtrt_plugins.so`.
3939

40-
A sample runtime application on how to run a network with plugins can be found <a href="https://github.com/NVIDIA/TRTorch/tree/master/examples/trtorchrt_example" >here</a>
40+
A sample runtime application on how to run a network with plugins can be found <a href="https://github.com/NVIDIA/Torch-TensorRT/tree/master/examples/trtorchrt_example" >here</a>

0 commit comments

Comments
 (0)