Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用trtexec命令行转换得到的trt推理报错 #47

Closed
Nolan0206 opened this issue Sep 1, 2022 · 4 comments
Closed

使用trtexec命令行转换得到的trt推理报错 #47

Nolan0206 opened this issue Sep 1, 2022 · 4 comments

Comments

@Nolan0206
Copy link

首先非常感谢你的分享。
我在windows11下使用pip 安装nvidia-tensorrt会报错,所以在docker环境中使用trtexec命令进行转换,在用trt.py推理时遇到如下报错:
Namespace(end2end=False, engine='../yolov7/weights/weights/test_no_sim.trt', image='../yolov7/inference/images/boat.jpg', output='test2.jpg', video=None)
[09/01/2022-03:26:21] [TRT] [E] 1: [stdArchiveReader.cpp::StdArchiveReader::35] Error Code 1: Serialization (Serialization assertion safeVersionRead == safeSerializationVersion failed.Version tag does not match. Note: Current Version: 0, Serialized Engine Version: 43)
[09/01/2022-03:26:21] [TRT] [E] 4: [runtime.cpp::deserializeCudaEngine::50] Error Code 4: Internal Error (Engine deserialization failed.)
Traceback (most recent call last):
File "trt.py", line 27, in
pred = Predictor(engine_path=args.engine)
File "trt.py", line 11, in init
super(Predictor, self).init(engine_path)
File "/mnt/tensorrt-python/utils/utils.py", line 31, in init
self.context = engine.create_execution_context()
AttributeError: 'NoneType' object has no attribute 'create_execution_context'
使用的是自己训练的yolov7,转onnx命令是:python export.py --weights weights/weights/best_rep.pt
转trt命令是/usr/src/tensorrt/bin/trtexec --onnx=best_rep.onnx --saveEngine=test_no_sim.trt --fp16
推理命令是python trt.py -e ../yolov7/weights/weights/test_no_sim.trt -i ../yolov7/inference/images/boat.jpg -o test2.jpg
docker环境是参照yolov7和你的pip安装搭建的,可以跑end2end,trt的版本不存在问题。

@Nolan0206
Copy link
Author

@Linaom1214

@Linaom1214
Copy link
Owner

Linaom1214 commented Sep 1, 2022

docker 里trt版本和本地
版本不一致

 Error Code 1: Serialization (Serialization assertion safeVersionRead == safeSerializationVersion failed.Version tag does not match. Note: Current Version: 0, Serialized Engine Version: 43)

@rance1108
Copy link

[E] Error[1]: [stdArchiveReader.cpp::StdArchiveReader::34] Error Code 1: Serialization (Serialization assertion safeVersionRead == safeSerializationVersion failed.Version tag does not match. Note: Current Version: 43, Serialized Engine Version: 0)
I got the same error, which version of docker image or tensorrt should I use?

@Linaom1214
Copy link
Owner

Current Version: 43, Serialized Engine Versi

the export engine env should same as the infer env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants