Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Report "std::bad_alloc" when I load the model. #133

Closed
TonyWu199 opened this issue Jul 12, 2021 · 6 comments
Closed

Report "std::bad_alloc" when I load the model. #133

TonyWu199 opened this issue Jul 12, 2021 · 6 comments
Labels
question Further information is requested

Comments

@TonyWu199
Copy link

TonyWu199 commented Jul 12, 2021

The problem happen in main.cpp

https://github.com/zhiqwang/yolov5-rt-stack/blob/82d6afbfc6286ec4e01c9a75730b4c9b9c90fd86/deployment/src/main.cpp#L135

I get an error

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Edited by @zhiqwang for code formatting

@TonyWu199 TonyWu199 added the question Further information is requested label Jul 12, 2021
@zhiqwang
Copy link
Owner

zhiqwang commented Jul 12, 2021

Hi @TonyWu199 ,

Sorry I could not repreduce this bug now. I guess that you are using the wrong path of the generated torchscript file, please double check that the file path you are pointing to is correct.

BTW, we will update the C++ interface of libtorch in this week, check out #132 (comment) for more details.

@TonyWu199
Copy link
Author

@zhiqwang Thanks for this quick answer! I have checked my path several times and this is not the cause.

@zhiqwang
Copy link
Owner

@TonyWu199 , We will update the libtorch interface of TorchVision soon, and let us further check whether we still encounter this problem in the new version.

@zhiqwang
Copy link
Owner

@TonyWu199 - Sorry for now I couldn't reproduce your bug, I guess this problem is caused by cxxopts, could you write the file path directly in
https://github.com/zhiqwang/yolov5-rt-stack/blob/82d6afbfc6286ec4e01c9a75730b4c9b9c90fd86/deployment/src/main.cpp#L134-L135

So that we could rule out whether it is caused by cxxopts.

@TonyWu199
Copy link
Author

@zhiqwang I follow your suggestions, but it seems this problem is not caused by cxxopts. I guess it is because the libotrch version?

@zhiqwang
Copy link
Owner

zhiqwang commented Jul 13, 2021

Hi @TonyWu199 , We've updated the C++ interface in #136. Besides we also provide an end-to-end and minimal example of how to use yolort models in Unit-test with following scripts

https://github.com/zhiqwang/yolov5-rt-stack/blob/ec5464df80abb91c2e94404b296d0ef5cca17c91/.github/workflows/ci_test.yml#L93-L104

This example is independent of cxxopts, let me know if this can work properly.

Repository owner locked and limited conversation to collaborators Sep 1, 2021
@zhiqwang zhiqwang closed this as completed Sep 1, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants