Toybrick

pytorch模型转换失败

happylinhxl

注册会员

积分
76
发表于 2020-12-29 09:49:54    查看: 272|回复: 1 | [复制链接]    打印 | 显示全部楼层
环境:ubuntu16.04, rknn_toolkit_v1.4.0 , python3.6, tensorflow=1.13.1, pytorch=1.2.0 torchvision=0.4.0
加载模型文件出错。错误如下:
E Catch exception when loading pytorch model: ./model_070000.pth!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 657, in rknn.api.rknn_base.RKNNBase.load_pytorch
E   File "rknn/base/RKNNlib/app/importer/import_pytorch.py", line 97, in rknn.base.RKNNlib.app.importer.import_pytorch.ImportPytorch.run
E   File "rknn/base/RKNNlib/converter/convert_pytorch.py", line 737, in rknn.base.RKNNlib.converter.convert_pytorch.convert_pytorch.__init__
E   File "/home/hxl/miniconda3/envs/rknn140/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*) + 0x5b (0x7efd8d5e1bcb in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/torch/lib/libc10.so)
E frame #1: caffe2::serialize:yTorchStreamReader::valid(char const*) + 0x6b (0x7efd8f1ce12b in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/torch/lib/libtorch.so)
E frame #2: caffe2::serialize:yTorchStreamReader::init() + 0x9a (0x7efd8f1d1bda in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/torch/lib/libtorch.so)
E frame #3: caffe2::serialize:yTorchStreamReader:yTorchStreamReader(std::string const&) + 0x60 (0x7efd8f1d4c40 in /home/hxl/miniconda3/envs/rknn140/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 (0x7efd902b3a28 in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/torch/lib/libtorch.so)
E frame #5: <unknown function> + 0x498723 (0x7efd92402723 in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
E frame #6: <unknown function> + 0x1977b6 (0x7efd921017b6 in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
E <omitting python frames>
E frame #11: <unknown function> + 0x1d888 (0x7efd96710888 in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #12: <unknown function> + 0x1e457 (0x7efd96711457 in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #13: <unknown function> + 0xc5a3d (0x7efd967b8a3d in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #19: <unknown function> + 0x659c (0x7efd97f7859c in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #20: <unknown function> + 0xc851 (0x7efd97f7e851 in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #21: <unknown function> + 0x14a6c (0x7efd97f86a6c in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-36m-x86_64-linux-gnu.so)
E frame #22: <unknown function> + 0x22e2d (0x7efddc369e2d in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/api/rknn_base.cpython-36m-x86_64-linux-gnu.so)
E frame #23: <unknown function> + 0x2302e (0x7efddc36a02e in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/api/rknn_base.cpython-36m-x86_64-linux-gnu.so)
E frame #24: <unknown function> + 0x6673b (0x7efddc3ad73b in /home/hxl/miniconda3/envs/rknn140/lib/python3.6/site-packages/rknn/api/rknn_base.cpython-36m-x86_64-linux-gnu.so)
E frame #39: __libc_start_main + 0xf0 (0x7efdec5ba840 in /lib/x86_64-linux-gnu/libc.so.6)


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

jefferyzhang

超级版主

积分
7316
发表于 2020-12-29 10:28:37 | 显示全部楼层
首先你的pytorch文件得能用pytorch1.2正常打开并推理。

log显示你的pth文件压根就不能被pytorch1.2给打开
E Catch exception when loading pytorch model: ./model_070000.pth
回复

使用道具 举报

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

本版积分规则

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


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