RuntimeError: [enforce fail at inline_container.cc:137] . PytorchStreamReader failed reading zip archive: failed finding central directory

Hello…
I have a Pytorch Model which I need convert to NPU model via this command line,
*./bin/convertpytorch --pytorch-model cnn_new.pt --net-output cnn.json *
–data-output cnn.data --input-size-list ‘1,28,28’, but I get an error:

RuntimeError: [enforce fail at inline_container.cc:137] . PytorchStreamReader failed reading zip archive: failed finding central directory
frame #0: c10::ThrowEnforceNotMet(char const*, int, char const*, std::string const&, void const*) + 0x47 (0x7f4cdce6de17 in /home/ali/Desktop/aml_npu_sdk_6.4.0.10/acuity-toolkit/bin/acuitylib/libc10.so)
frame #1: caffe2::serialize::PyTorchStreamReader::valid(char const*) + 0x6b (0x7f4cdfdf675b in /home/ali/Desktop/aml_npu_sdk_6.4.0.10/acuity-toolkit/bin/acuitylib/libtorch.so)
frame #2: caffe2::serialize::PyTorchStreamReader::init() + 0x9a (0x7f4cdfdfa20a in /home/ali/Desktop/aml_npu_sdk_6.4.0.10/acuity-toolkit/bin/acuitylib/libtorch.so)
frame #3: caffe2::serialize::PyTorchStreamReader::PyTorchStreamReader(std::string const&) + 0x60 (0x7f4cdfdfd270 in /home/ali/Desktop/aml_npu_sdk_6.4.0.10/acuity-toolkit/bin/acuitylib/libtorch.so)
frame #4: torch::jit::import_ir_module(std::shared_ptrtorch::jit::script::CompilationUnit, std::string const&, c10::optionalc10::Device, std::unordered_map<std::string, std::string, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, std::string> > >&) + 0x38 (0x7f4ce0edc088 in /home/ali/Desktop/aml_npu_sdk_6.4.0.10/acuity-toolkit/bin/acuitylib/libtorch.so)
frame #5: + 0x4d6abc (0x7f4d271ddabc in /home/ali/Desktop/aml_npu_sdk_6.4.0.10/acuity-toolkit/bin/acuitylib/libtorch_python.so)
frame #6: + 0x1d3f04 (0x7f4d26edaf04 in /home/ali/Desktop/aml_npu_sdk_6.4.0.10/acuity-toolkit/bin/acuitylib/libtorch_python.so)

frame #29: ./bin/convertpytorch() [0x402ca1]
frame #30: ./bin/convertpytorch() [0x403087]
frame #31: __libc_start_main + 0xf3 (0x7f4d6f2110b3 in /lib/x86_64-linux-gnu/libc.so.6)
frame #32: ./bin/convertpytorch() [0x401a9e]

[4357] Failed to execute script convertpytorch

do you know how to get rid of this error?
if you know about this error please refer to me your solution

thanks…

Note : I use torch==1.2 according to the latest SDK—> 6.4.0.10

Same error here. Exactly same versions indicated in requirements.txt

I meet the same problem with you.Have you solved the problem

@Frank
I also meet the same problem with you.

I meet the same problem with you.Have you solved the problem

即使 在numbqq/npu-sdk 这个docker中训练出来的pth模型,也转换失败。

错误如下:
I Start importing pytorch…
/model/CenterTrack/exp/ddd/nuScenes_3Ddetection_e140/model_last.pth ********************
Traceback (most recent call last):
File “convertpytorch.py”, line 51, in
File “convertpytorch.py”, line 41, in main
File “acuitylib/vsi_nn.py”, line 146, in load_pytorch
File “acuitylib/app/importer/import_pytorch.py”, line 92, in run
File “acuitylib/converter/convert_pytorch.py”, line 508, in init
File “torch/jit/init.py”, line 162, in load
RuntimeError: [enforce fail at inline_container.cc:137] . PytorchStreamReader failed reading zip archive: failed finding central directory
frame #0: c10::ThrowEnforceNotMet(char const*, int, char const*, std::string const&, void const*) + 0x47 (0x7f07191aee17 in /acuity-toolkit/bin/acuitylib/libc10.so)
frame #1: caffe2::serialize::PyTorchStreamReader::valid(char const*) + 0x6b (0x7f071c13775b in /acuity-toolkit/bin/acuitylib/libtorch.so)
frame #2: caffe2::serialize::PyTorchStreamReader::init() + 0x9a (0x7f071c13b20a in /acuity-toolkit/bin/acuitylib/libtorch.so)
frame #3: caffe2::serialize::PyTorchStreamReader::PyTorchStreamReader(std::string const&) + 0x60 (0x7f071c13e270 in /acuity-toolkit/bin/acuitylib/libtorch.so)
frame #4: torch::jit::import_ir_module(std::shared_ptrtorch::jit::script::CompilationUnit, std::string const&, c10::optionalc10::Device, std::unordered_map<std::string, std::string, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, std::string> > >&) + 0x38 (0x7f071d21d088 in /acuity-toolkit/bin/acuitylib/libtorch.so)
frame #5: + 0x4d6abc (0x7f076351eabc in /acuity-toolkit/bin/acuitylib/libtorch_python.so)
frame #6: + 0x1d3f04 (0x7f076321bf04 in /acuity-toolkit/bin/acuitylib/libtorch_python.so)

frame #29: …/bin/convertpytorch() [0x402ca1]
frame #30: …/bin/convertpytorch() [0x403087]
frame #31: __libc_start_main + 0xe7 (0x7f07e11aab97 in /lib/x86_64-linux-gnu/libc.so.6)
frame #32: …/bin/convertpytorch() [0x401a9e]

[34] Failed to execute script convertpytorch

你解决这个问题了吗?我也遇到这个问题了。

No. give up this method.
已切到tengine lite去了。

顺带吐槽一下,amlogic以及khadas 对pytorch支持目测不太够啊。

@Frank I’m facing this same issue. How to resolve it?

@Frank 我也遇到了同样的问题,请问有解决方案吗?

@kiwin Pytorch建议是转换成onnx模型,再使用转换工具。对Pytorch的支持是有工具方来做的。