AttributeError: ‘tensorrt.tensorrt.Builder‘ object has no attrib

举报
AI浩 发表于 2023/01/09 05:58:49 2023/01/09
【摘要】 问题描述[11/16 16:54:10 trt_export]: Loading ONNX file from path ../../outputs/onnx_model/baseline_R18.onnx...[11/16 16:54:10 trt_export]: Beginning ONNX file parsing[11/16 16:54:10 trt_export]: Compl...

问题描述

[11/16 16:54:10 trt_export]: Loading ONNX file from path ../../outputs/onnx_model/baseline_R18.onnx...
[11/16 16:54:10 trt_export]: Beginning ONNX file parsing
[11/16 16:54:10 trt_export]: Completed parsing of ONNX file.
D:\fast-reid-master\fast-reid-master\tools\deploy\trt_export.py:132: DeprecationWarning: Use set_memory_pool_limit instead.
  config.max_workspace_size = max_workspace_size * (1 << 25)
[11/16 16:54:10 trt_export]: Building an engine from file ../../outputs/onnx_model/baseline_R18.onnx; this may take a while...
Traceback (most recent call last):
  File "D:\fast-reid-master\fast-reid-master\tools\deploy\trt_export.py", line 166, in <module>
    onnx2trt(onnx_file_path, engineFile, args.mode, int8_calibrator=int8_calib)
  File "D:\fast-reid-master\fast-reid-master\tools\deploy\trt_export.py", line 145, in onnx2trt
    engine = builder.build_cuda_engine(network)
AttributeError: 'tensorrt.tensorrt.Builder' object has no attribute 'build_cuda_engine'

问题原因

tensorrt版本大于等于7时,不再使用build_cuda_engine

解决办法

    engine = builder.build_cuda_engine(network)

改为:

    profile = builder.create_optimization_profile()
    config = builder.create_builder_config()
    config.add_optimization_profile(profile)
    engine = builder.build_engine(network, config)

参考文章:
https://blog.csdn.net/qq_38333041/article/details/122481404

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。