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

[Inference] Save optimized model by pass #53696

Merged

Conversation

shentanyue
Copy link
Contributor

@shentanyue shentanyue commented May 10, 2023

PR types

New features

PR changes

Others

Description

文档更新链接:PaddlePaddle/Paddle-Inference-Demo#446
支持保存经过IR PASS优化后的模型,且后续能够正常加载推理。
使用方法:

config = paddle.inference.Config(model_path, param_path)
config.enable_save_optim_model(True) # 默认保存在"model_path/"目录下
# 可以通过`opt_cache_dir`来指定优化后模型的保存路径
config.set_optim_cache_dir("xxx")

推理优化模型时,需关闭IR优化,避免再次执行IR优化:

config.switch_ir_optim(False)

@paddle-bot
Copy link

paddle-bot bot commented May 10, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot
Copy link

paddle-bot bot commented May 10, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@shentanyue shentanyue force-pushed the support_inference_save_ir_params_xpu branch from 6d2aae8 to d0b9a50 Compare May 10, 2023 11:52
zhupengyang
zhupengyang previously approved these changes May 11, 2023
Copy link
Contributor

@zhupengyang zhupengyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shentanyue shentanyue force-pushed the support_inference_save_ir_params_xpu branch from 63c4a8e to 9d43ee1 Compare May 11, 2023 10:17
Copy link
Contributor

@yuanlehome yuanlehome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jiweibo jiweibo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shentanyue shentanyue merged commit fa08a51 into PaddlePaddle:develop May 19, 2023
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

Successfully merging this pull request may close these issues.

7 participants