Toybrick

加载pytorch模型报错

奥古师弟

注册会员

积分
115
发表于 2020-6-12 20:12:55    查看: 1058|回复: 9 | [复制链接]    打印 | 显示全部楼层
.pb模型可以在torch==1.2.0上正常运行,但是采用rknn.load_pytorch()加载模型的时候报错,如下。机器上装的rknn_toolkit=1.3.0。


W:tensorflow:From /root/venv/lib/python3.6/site-packages/onnx_tf/handlers/backend/log.py:10: The name tf.log is deprecated. Please use tf.math.log instead.

W:tensorflow:From /root/venv/lib/python3.6/site-packages/onnx_tf/handlers/backend/random_normal.py:9: The name tf.random_normal is deprecated. Please use tf.random.normal instead.

W:tensorflow:From /root/venv/lib/python3.6/site-packages/onnx_tf/handlers/backend/random_uniform.py:9: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

W:tensorflow:From /root/venv/lib/python3.6/site-packages/onnx_tf/handlers/backend/upsample.py:13: The name tf.image.resize_images is deprecated. Please use tf.image.resize instead.

/root/venv/lib/python3.6/site-packages/onnx_tf/common/__init__.py:87: UserWarning: FrontendHandler.get_outputs_names is deprecated. It will be removed in future release.. Use node.outputs instead.
  warnings.warn(message)
./yolov5s.pt ********************
E Catch exception when loading pytorch model: ./yolov5s.pt!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 567, in rknn.api.rknn_base.RKNNBase.load_pytorch
E   File "rknn/base/RKNNlib/app/importer/import_pytorch.py", line 95, in rknn.base.RKNNlib.app.importer.import_pytorch.ImportPytorch.run
E   File "rknn/base/RKNNlib/converter/convert_pytorch.py", line 499, in rknn.base.RKNNlib.converter.convert_pytorch.convert_pytorch.__init__
E   File "/root/venv/lib/python3.6/site-packages/torch/jit/__init__.py", line 162, in load
E     cpp_module = torch._C.import_ir_module(cu, f, map_location, _extra_files)
E RuntimeError: [enforce fail at inline_container.cc:137] . PytorchStreamReader failed reading zip archive: failed finding central directory
E frame #0: c10::ThrowEnforceNotMet(char const*, int, char const*, std::string const&, void const*) + 0x47 (0x7fa0e971ae17 in /root/venv/lib/python3.6/site-packages/torch/lib/libc10.so)
E frame #1: caffe2::serialize:yTorchStreamReader::valid(char const*) + 0x6b (0x7f9f5861175b in /root/venv/lib/python3.6/site-packages/torch/lib/libtorch.so)
E frame #2: caffe2::serialize:yTorchStreamReader::init() + 0x9a (0x7f9f5861520a in /root/venv/lib/python3.6/site-packages/torch/lib/libtorch.so)
E frame #3: caffe2::serialize:yTorchStreamReader:yTorchStreamReader(std::string const&) + 0x60 (0x7f9f58618270 in /root/venv/lib/python3.6/site-packages/torch/lib/libtorch.so)
E frame #4: torch::jit::import_ir_module(std::shared_ptr<torch::jit::script::CompilationUnit>, std::string const&, c10:ptional<c10:evice>, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > >&) + 0x38 (0x7f9f596f7088 in /root/venv/lib/python3.6/site-packages/torch/lib/libtorch.so)
E frame #5: <unknown function> + 0x4d69dc (0x7fa0596bf9dc in /root/venv/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
E frame #6: <unknown function> + 0x1d3ef4 (0x7fa0593bcef4 in /root/venv/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
E frame #7: /root/venv/bin/python3.6() [0x50a635]
E frame #8: _PyEval_EvalFrameDefault + 0x444 (0x50bfb4 in /root/venv/bin/python3.6)
E frame #9: /root/venv/bin/python3.6() [0x507d64]
E frame #10: PyEval_EvalCodeEx + 0x39 (0x50acf9 in /root/venv/bin/python3.6)
E frame #11: <unknown function> + 0x18578 (0x7fa0c9e9a578 in /root/venv/lib/python3.6/site-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #12: <unknown function> + 0x18e37 (0x7fa0c9e9ae37 in /root/venv/lib/python3.6/site-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #13: <unknown function> + 0xb04d5 (0x7fa0c9f324d5 in /root/venv/lib/python3.6/site-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #14: /root/venv/bin/python3.6() [0x5946bc]
E frame #15: /root/venv/bin/python3.6() [0x54a005]
E frame #16: /root/venv/bin/python3.6() [0x5513d1]
E frame #17: <unknown function> + 0x6a4c (0x7fa0ca157a4c in /root/venv/lib/python3.6/site-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #18: <unknown function> + 0xc67c (0x7fa0ca15d67c in /root/venv/lib/python3.6/site-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #19: <unknown function> + 0x1255c (0x7fa0ca16355c in /root/venv/lib/python3.6/site-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #20: <unknown function> + 0x20bdd (0x7fa12b44cbdd in /root/venv/lib/python3.6/site-packages/rknn/api/rknn_base.cpython-36m-x86_64-linux-gnu.so)
E frame #21: <unknown function> + 0x20dde (0x7fa12b44cdde in /root/venv/lib/python3.6/site-packages/rknn/api/rknn_base.cpython-36m-x86_64-linux-gnu.so)
E frame #22: <unknown function> + 0xce615 (0x7fa12b4fa615 in /root/venv/lib/python3.6/site-packages/rknn/api/rknn_base.cpython-36m-x86_64-linux-gnu.so)
E frame #23: _PyObject_FastCallKeywords + 0x19c (0x5a9cbc in /root/venv/bin/python3.6)
E frame #24: /root/venv/bin/python3.6() [0x50a5c3]
E frame #25: _PyEval_EvalFrameDefault + 0x444 (0x50bfb4 in /root/venv/bin/python3.6)
E frame #26: /root/venv/bin/python3.6() [0x507d64]
E frame #27: /root/venv/bin/python3.6() [0x509a90]
E frame #28: /root/venv/bin/python3.6() [0x50a48d]
E frame #29: _PyEval_EvalFrameDefault + 0x1226 (0x50cd96 in /root/venv/bin/python3.6)
E frame #30: /root/venv/bin/python3.6() [0x507d64]
E frame #31: PyEval_EvalCode + 0x23 (0x50ae13 in /root/venv/bin/python3.6)
E frame #32: /root/venv/bin/python3.6() [0x634c82]
E frame #33: PyRun_FileExFlags + 0x97 (0x634d37 in /root/venv/bin/python3.6)
E frame #34: PyRun_SimpleFileExFlags + 0x17f (0x6384ef in /root/venv/bin/python3.6)
E frame #35: Py_Main + 0x591 (0x639091 in /root/venv/bin/python3.6)
E frame #36: main + 0xe0 (0x4b0d00 in /root/venv/bin/python3.6)
E frame #37: __libc_start_main + 0xe7 (0x7fa14f4d1b97 in /lib/x86_64-linux-gnu/libc.so.6)
E frame #38: _start + 0x2a (0x5b250a in /root/venv/bin/python3.6)
Load pytorch model failed!

Process finished with exit code 255




回复

使用道具 举报

elexxy

新手上路

积分
45
发表于 2020-6-22 18:05:39 | 显示全部楼层
一模一样的错误+1
回复

使用道具 举报

奥古师弟

注册会员

积分
115
 楼主| 发表于 2020-7-16 19:24:43 | 显示全部楼层
我也遇到这个问题了
回复

使用道具 举报

apupu

注册会员

积分
113
发表于 2020-8-10 13:50:03 | 显示全部楼层
请问问题解决了吗?分享下经验哈
回复

使用道具 举报

leok

版主

积分
755
发表于 2020-8-11 09:02:42 | 显示全部楼层
进官方QQ群提问,1025468710
回复

使用道具 举报

athtan

新手上路

积分
21
发表于 2020-8-11 09:33:51 | 显示全部楼层
我也遇到了
回复

使用道具 举报

RK用户

中级会员

积分
218
发表于 2020-10-14 11:11:04 | 显示全部楼层
我也遇到了
回复

使用道具 举报

zhw

注册会员

积分
68
发表于 2020-10-15 10:52:24 | 显示全部楼层
+1,问题解决了没
回复

使用道具 举报

1105060120

注册会员

积分
164
发表于 2020-10-15 16:36:49 | 显示全部楼层
我也遇到了,问题解决了吗
回复

使用道具 举报

jefferyzhang

超级版主

积分
6172
发表于 2020-10-16 10:43:15 | 显示全部楼层
1. 核对rknntoolkit对应的pytorch版本 (目前只支持到1.2)
2. 用最新的rknntoolkit尝试(目前是1.4.0)
3. 加置顶帖qq官方群讨论。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表