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

opt tool - Only version 0 is supported #4763

Closed
Qengineering opened this issue Nov 17, 2020 · 4 comments
Closed

opt tool - Only version 0 is supported #4763

Qengineering opened this issue Nov 17, 2020 · 4 comments

Comments

@Qengineering
Copy link

Having issue #4560, I followed the given answer.

Hi, you need to convert the original model again to make it workable on Paddle-Lite v2.7.
You can follow steps below:

1、 Clone Paddle-Lite and checkout to v2.7-beta: cd Paddle-Lite && git checkout v2.7-beta
2、Compile opt from v2.7-beta: ./lite/tools/build.sh build_optimize_tool
3、 Convert original model by opt of v2.7: ./opt --model_dir=your_model_path --valid_targets=your_target -->optimize_out=opt_model_v2.7
4、 Compile inference library from v2.7
5、Run opt_model_v2.7 on inference library from v2.7

1 + 2) Done -> succes.
3) Get original model

Install PaddlePaddle v2.0.0-rc0 + PaddleHub v1.8.1 ->succes.

$ python3
>>> import paddlehub as hub
>>> import paddle
>>> paddle.enable_static()
>>> pyramidbox_lite_mobile_mask = hub.Module(name="pyramidbox_lite_mobile_mask")
>>> pyramidbox_lite_mobile_mask.save_inference_model(dirname="test_program")

Got test_program

.
├── mask_detector
│   ├──__model__
│   └──__params__
└── pyramidbox_lite
    ├── __model__
    └──__params__

Loaded the mask_detector in opt tool and got this error:
image

Note: same Only version 0 is supported error is given with the model is generated by PaddlePaddle v1.8.5, as being the latest stable version.

@Qengineering
Copy link
Author

Found a workaround.
Instead of --model_dir, used --model_file= and --param_file=.
image

@Qengineering
Copy link
Author

However, the generated Paddle-Lite model can't be run due to no Op found for feed error.
image

@DannyIsFunny
Copy link
Collaborator

DannyIsFunny commented Nov 20, 2020

Are you linking your project to Paddle-Lite static library libpaddle_api_light_bundled.a ?In this case, you need to include extra head files as listed below:

/////////////////////////////////////////////////////////////////////////
// If this demo is linked to static libaray:libpaddle_api_light_bundled.a
// , you should include `paddle_use_ops.h` and `paddle_use_kernels.h`.
/////////////////////////////////////////////////////////////////////////
#include "paddle_use_kernels.h"  // NOLINT
#include "paddle_use_ops.h"      // NOLINT

@Qengineering
Copy link
Author

Works like a charm!
Thanks @DannyIsFunny !

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