Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yolov5s 转pnnx #3428

Open
wm901115nwpu opened this issue Dec 15, 2021 · 2 comments
Open

yolov5s 转pnnx #3428

wm901115nwpu opened this issue Dec 15, 2021 · 2 comments

Comments

@wm901115nwpu
Copy link

./bin/pnnx yolov5s.pt inputshape=1,3,640,640 inputshape2=1,3,320,320 device=gpu moduleop=yolov5.models.common.Focus,models.yolo.Detect device=cpu
pnnxparam = yolov5s.pnnx.param
pnnxbin = yolov5s.pnnx.bin
pnnxpy = yolov5s_pnnx.py
ncnnparam = yolov5s.ncnn.param
ncnnbin = yolov5s.ncnn.bin
ncnnpy = yolov5s_ncnn.py
optlevel = 2
device = cpu
inputshape = [1,3,640,640]
inputshape2 = [1,3,320,320]
customop =
moduleop = yolov5.models.common.Focus,models.yolo.Detect
libc++abi: terminating with uncaught exception of type c10::Error: PytorchStreamReader failed locating file constants.pkl: file not found
Exception raised from valid at ../caffe2/serialize/inline_container.cc:158 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) + 98 (0x104b74522 in libc10.dylib)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 106 (0x104b72c3a in libc10.dylib)
frame #2: caffe2::serialize::PyTorchStreamReader::valid(char const*, char const*) + 128 (0x129c94300 in libtorch_cpu.dylib)
frame #3: caffe2::serialize::PyTorchStreamReader::getRecordID(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 98 (0x129c94d22 in libtorch_cpu.dylib)
frame #4: caffe2::serialize::PyTorchStreamReader::getRecord(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 70 (0x129c94466 in libtorch_cpu.dylib)
frame #5: torch::jit::readArchiveAndTensors(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, c10::optional<std::__1::function<c10::StrongTypePtr (c10::QualifiedName const&)> >, c10::optional<std::__1::function<c10::intrusive_ptr<c10::ivalue::Object, c10::detail::intrusive_target_default_null_typec10::ivalue::Object > (c10::StrongTypePtr, c10::IValue)> >, c10::optionalc10::Device, caffe2::serialize::PyTorchStreamReader&, std::__1::shared_ptrtorch::jit::DeserializationStorageContext) + 235 (0x12b6e54fb in libtorch_cpu.dylib)
frame #6: torch::jit::(anonymous namespace)::ScriptModuleDeserializer::readArchive(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 209 (0x12b6e2221 in libtorch_cpu.dylib)
frame #7: torch::jit::(anonymous namespace)::ScriptModuleDeserializer::deserialize(c10::optionalc10::Device, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > >&) + 766 (0x12b6e016e in libtorch_cpu.dylib)
frame #8: torch::jit::load(std::__1::shared_ptrcaffe2::serialize::ReadAdapterInterface, c10::optionalc10::Device, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > >&) + 613 (0x12b6e1bc5 in libtorch_cpu.dylib)
frame #9: torch::jit::load(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, c10::optionalc10::Device, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > >&) + 119 (0x12b6e1df7 in libtorch_cpu.dylib)
frame #10: torch::jit::load(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, c10::optionalc10::Device) + 43 (0x12b6e1ceb in libtorch_cpu.dylib)
frame #11: main + 4136 (0x1042975a8 in pnnx)
frame #12: start + 462 (0x1123fa4fe in dyld)

[1] 13352 abort ./bin/pnnx yolov5s.pt inputshape=1,3,640,640 inputshape2=1,3,320,320

@superbayes
Copy link

@wm901115nwpu 提供一下pth模型

@wm901115nwpu
Copy link
Author

我这边转好了,之前用的是pytorch pth的模型,我该用torchscript就可以了,是不是只能用torchscript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants