Toybrick

pth转rknn失败

zjmmm

中级会员

积分
304
楼主
发表于 2020-12-16 11:55:04    查看: 9173|回复: 0 | [复制链接]    打印 | 只看该作者
板子:3399prod,rknn-toolkit:1.4.0,torch:1.2.0我想把nanodet_m.pth转成rknn的模型,但报了如下的错
E Catch exception when loading pytorch model: nanodet_m.pth!
E Traceback (most recent call last):
E   File "rknn/api/rknn_base.py", line 611, 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 552, in rknn.base.RKNNlib.converter.convert_pytorch.convert_pytorch.__init__
E   File "/usr/local/lib/python3.7/dist-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: version_number <= kMaxSupportedFileFormatVersion INTERNAL ASSERT FAILED at ../caffe2/serialize/inline_container.cc:131, please report a bug to PyTorch. Attempted to read a PyTorch file with version 3, but the maximum supported version for reading is 1. Your PyTorch installation may be too old. (init at ../caffe2/serialize/inline_container.cc:131)
E frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0x68 (0x7f8b374648 in /usr/local/lib/python3.7/dist-packages/torch/lib/libc10.so)
E frame #1: caffe2::serialize:yTorchStreamReader::init() + 0x15e0 (0x7f8c819048 in /usr/local/lib/python3.7/dist-packages/torch/lib/libtorch.so)
E frame #2: caffe2::serialize:yTorchStreamReader:yTorchStreamReader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0x70 (0x7f8c8199e0 in /usr/local/lib/python3.7/dist-packages/torch/lib/libtorch.so)
E frame #3: torch::jit::import_ir_module(std::shared_ptr<torch::jit::script::CompilationUnit>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, c10:ptional<c10:evice>, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&) + 0x3c (0x7f8d4a388c in /usr/local/lib/python3.7/dist-packages/torch/lib/libtorch.so)
E frame #4: <unknown function> + 0x491948 (0x7f8e92f948 in /usr/local/lib/python3.7/dist-packages/torch/lib/libtorch_python.so)
E frame #5: <unknown function> + 0x1aa3b4 (0x7f8e6483b4 in /usr/local/lib/python3.7/dist-packages/torch/lib/libtorch_python.so)
E <omitting python frames>
E frame #11: <unknown function> + 0x1aa28 (0x7f91991a28 in /usr/local/lib/python3.7/dist-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-37m-aarch64-linux-gnu.so)
E frame #12: <unknown function> + 0x23b74 (0x7f9199ab74 in /usr/local/lib/python3.7/dist-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-37m-aarch64-linux-gnu.so)
E frame #13: <unknown function> + 0x83408 (0x7f919fa408 in /usr/local/lib/python3.7/dist-packages/rknn/base/RKNNlib/converter/convert_pytorch.cpython-37m-aarch64-linux-gnu.so)
E frame #17: python3() [0x48dff4]
E frame #18: python3() [0x487858]
E frame #19: <unknown function> + 0x6c88 (0x7f92075c88 in /usr/local/lib/python3.7/dist-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-37m-aarch64-linux-gnu.so)
E frame #20: <unknown function> + 0x10160 (0x7f9207f160 in /usr/local/lib/python3.7/dist-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-37m-aarch64-linux-gnu.so)
E frame #21: <unknown function> + 0x13020 (0x7f92082020 in /usr/local/lib/python3.7/dist-packages/rknn/base/RKNNlib/app/importer/import_pytorch.cpython-37m-aarch64-linux-gnu.so)
E frame #22: <unknown function> + 0x217d0 (0x7fa62dc7d0 in /usr/local/lib/python3.7/dist-packages/rknn/api/rknn_base.cpython-37m-aarch64-linux-gnu.so)
E frame #23: <unknown function> + 0x2386c (0x7fa62de86c in /usr/local/lib/python3.7/dist-packages/rknn/api/rknn_base.cpython-37m-aarch64-linux-gnu.so)
E frame #24: <unknown function> + 0x36434 (0x7fa62f1434 in /usr/local/lib/python3.7/dist-packages/rknn/api/rknn_base.cpython-37m-aarch64-linux-gnu.so)
E frame #34: python3() [0x431be8]
E frame #36: __libc_start_main + 0xe4 (0x7fa6767d24 in /lib/aarch64-linux-gnu/libc.so.6)
E frame #37: python3() [0x42c3b0]
done
--> Building model
Traceback (most recent call last):
  File "transform.py", line 50, in <module>
    rknn.build(do_quantization=False)
  File "/usr/local/lib/python3.7/dist-packages/rknn/api/rknn.py", line 222, in build
    inputs = self.rknn_base.net.get_input_layers()
AttributeError: 'NoneType' object has no attribute 'get_input_layers'


这里是根据报错提示说pytorch的版本太低。我想问下是这个的原因吗?同时还能安装版本更高的pytorch吗?

但是下面能print出done,不是说明load model已经过了吗?
麻烦解答下

回复

使用道具 举报

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

本版积分规则

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


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