Skip to content

Commit 638d02d

Browse files
authored
Merge pull request #439 from JuliaBareeva/pytrt
Code for the article How to convert a model from PyTorch to TensorRT
2 parents a71fe61 + c5f0307 commit 638d02d

File tree

8 files changed

+1197
-0
lines changed

8 files changed

+1197
-0
lines changed

PyTorch-ONNX-TensorRT/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# How to convert a model from PyTorch to TensorRT and speed up inference
2+
The blog post is here: https://www.learnopencv.com/how-to-convert-a-model-from-pytorch-to-tensorrt-and-speed-up-inference/
3+
4+
To run PyTorch part:
5+
```shell script
6+
python3 -m pip install -r requirements.txt
7+
python3 pytorch_model.py
8+
```
9+
10+
To run TensorRT part:
11+
1. Download and install NVIDIA CUDA 10.0 or later following by official instruction: [link](https://developer.nvidia.com/cuda-10.0-download-archive)
12+
2. Download and extract CuDNN library for your CUDA version (login required): [link](https://developer.nvidia.com/rdp/cudnn-download)
13+
3. Download and extract NVIDIA TensorRT library for your CUDA version (login required):
14+
[link](https://developer.nvidia.com/nvidia-tensorrt-6x-download).
15+
The minimum required version is 6.0.1.5.
16+
Please follow the [Installation Guide](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html) for your system and don't forget to install Python's part
17+
4. Add the absolute path to CUDA, TensorRT, CuDNN libs to the environment variable ```PATH``` or ```LD_LIBRARY_PATH```
18+
5. Install [PyCUDA](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing-pycuda)
19+
20+
```shell script
21+
python3 trt_inference.py
22+
```
23+
24+
# AI Courses by OpenCV
25+
26+
Want to become an expert in AI? [AI Courses by OpenCV](https://opencv.org/courses/) is a great place to start.
27+
28+
<a href="https://opencv.org/courses/">
29+
<p align="center">
30+
<img src="https://www.learnopencv.com/wp-content/uploads/2020/04/AI-Courses-By-OpenCV-Github.png">
31+
</p>
32+
</a>

0 commit comments

Comments
 (0)