-
Notifications
You must be signed in to change notification settings - Fork 141
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
Comments
docker 里trt版本和本地
|
[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) |
the export engine env should same as the infer env |
首先非常感谢你的分享。
我在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的版本不存在问题。
The text was updated successfully, but these errors were encountered: