AI Ants

迈向通用人工智能之路

0%

TensorRT安装并使用简述

环境安装

我这里使用的是TensorRT-5.1.5.0版本,其他版本可能会有一些出入。
安装好的TensorRT环境的docker镜像(docker pull 857470845/hvd_trt_apex_torch:v1)可供下载使用。

示例运行

主要测试两种示例:1、利用安装好的convert_to_uff.py脚本将tensorflow的pb模型文件(lenet)转成uff格式文件,并测试mnist数据;
将TensorRT-5.1.5.0项目所在路径挂载到/mnt下

1
2
3
4
5
##cd /mnt/TensorRT-5.1.5.0/samples/python/end_to_end_tensorflow_mnist
mkdir models
python model.py
##convert_to_uff.py脚本在镜像中的路径:/opt/conda/lib/python3.6/site-packages/uff/bin/convert_to_uff.py
python /opt/conda/lib/python3.6/site-packages/uff/bin/convert_to_uff.py --input_file models/lenet5.pb

trt_1

2、直接测试samples/sampleMNIST程序
可以直接在samples下make,产生所有的示例的bin;不过我这里是只单独编译测试samples/sampleMNIST示例。

trt-2

trt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
root@gpuserver002:/mnt/TensorRT-5.1.5.0/bin# ./sample_mnist --int8
&&&& RUNNING TensorRT.sample_mnist # ./sample_mnist --int8
[I] Building and running a GPU inference engine for MNIST
[W] [TRT] Calibrator is not being used. Users must provide dynamic range for all tensors that are not Int32.
[W] [TRT] Warning: no implementation of (Unnamed Layer* 9) [Constant] obeys the requested constraints, using a higher precision type
[W] [TRT] Warning: no implementation of ip2 obeys the requested constraints, using a higher precision type
[W] [TRT] Warning: no implementation of prob obeys the requested constraints, using a higher precision type
[I] Input:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@%+-: =@@@@@@@@@@@@
@@@@@@@%= -@@@**@@@@@@@
@@@@@@@ :%#@-#@@@. #@@@@@@
@@@@@@* +@@@@:*@@@ *@@@@@@
@@@@@@# +@@@@ @@@% @@@@@@@
@@@@@@@. :%@@.@@@. *@@@@@@@
@@@@@@@@- =@@@@. -@@@@@@@@
@@@@@@@@@%: +@- :@@@@@@@@@
@@@@@@@@@@@%. : -@@@@@@@@@@
@@@@@@@@@@@@@+ #@@@@@@@@@@
@@@@@@@@@@@@@@+ :@@@@@@@@@@
@@@@@@@@@@@@@@+ *@@@@@@@@@
@@@@@@@@@@@@@@: = @@@@@@@@@
@@@@@@@@@@@@@@ :@ @@@@@@@@@
@@@@@@@@@@@@@@ -@ @@@@@@@@@
@@@@@@@@@@@@@# +@ @@@@@@@@@
@@@@@@@@@@@@@* ++ @@@@@@@@@
@@@@@@@@@@@@@* *@@@@@@@@@
@@@@@@@@@@@@@# =@@@@@@@@@@
@@@@@@@@@@@@@@. +@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@

[I] Output:
0:
1:
2:
3:
4:
5:
6:
7:
8: **********
9:

&&&& PASSED TensorRT.sample_mnist # ./sample_mnist --int8

推荐工程:
https://github.com/NVIDIA/object-detection-tensorrt-example
https://github.com/NVIDIA/healthcare-on-tap-TRT-TRITON-demo

References

下载链接: https://developer.nvidia.com/nvidia-tensorrt-download
trt工程: https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html
项目地址: https://github.com/NVIDIA/TensorRT
参考博客: https://blog.csdn.net/zong596568821xp/article/details/86077553
Triton(tensorrt inference server): https://github.com/triton-inference-server/server

-------------本文结束感谢您的阅读-------------

本文标题:TensorRT安装并使用简述

文章作者:杨苏辉

发布时间:2020年12月17日 - 19:12

最后更新:2020年12月17日 - 23:06

原始链接:https://yangsuhui.github.io/p/4074.html

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

如果您觉得内容不错,可以对我打赏哦!