Toybrick

标题: 加载pytorch模型报错 [打印本页]

作者: 奥古师弟    时间: 2020-6-12 20:12
标题: 加载pytorch模型报错
.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    时间: 2020-6-22 18:05
一模一样的错误+1
作者: 奥古师弟    时间: 2020-7-16 19:24
我也遇到这个问题了
作者: apupu    时间: 2020-8-10 13:50
请问问题解决了吗?分享下经验哈
作者: leok    时间: 2020-8-11 09:02
进官方QQ群提问,1025468710
作者: athtan    时间: 2020-8-11 09:33
我也遇到了
作者: RK用户    时间: 2020-10-14 11:11
我也遇到了
作者: zhw    时间: 2020-10-15 10:52
+1,问题解决了没
作者: 1105060120    时间: 2020-10-15 16:36
我也遇到了,问题解决了吗
作者: jefferyzhang    时间: 2020-10-16 10:43
1. 核对rknntoolkit对应的pytorch版本 (目前只支持到1.2)
2. 用最新的rknntoolkit尝试(目前是1.4.0)
3. 加置顶帖qq官方群讨论。
作者: sunnysunny    时间: 2021-3-31 16:18
一样的问题,这个问题这么普遍,是不是总结解答一下,免的还有人问,qq群里不利于查找历史问题阿




欢迎光临 Toybrick (http://t.rock-chips.com/) Powered by Discuz! X3.3