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

Polish jit.save/load design & remove paddle.SaveLoadConfig #27623

Merged

Conversation

chenwhql
Copy link
Contributor

@chenwhql chenwhql commented Sep 27, 2020

PR types

Function optimization

PR changes

APIs

Describe

一、PR主要修改

根据预测接口paddle.static.save/load_inference_model的升级评审结论,对2.0主推的save/load接口进行了如下更改:

  1. 移除paddle.SaveLoadConfig,对于paddle.jit.save/load, paddle.load改为使用**kwargs作为兼容参数
  2. paddle.jit.save/load的路径参数model_path改为path,使其更加简洁并与paddle.save/load保持一致
  3. 改变paddle.jit.save/load参数path含义,原含义为【存储预测模型的目录】,更改后为【存储预测模型相关文件的前缀】
  4. 修改以上改动涉及到的所有单测

二、2.0 Save/Load全局概览

本次升级的主要目的是统一paddle各存储接口存储结果的组织形式,具体地,统一了paddle框架中save接口在"存储得到多个结果"时的文件组织方式,由原先【增加后缀】与【创建目录】共存的方式,改为统一使用【增加paddle标准后缀】的方式。

具体变化见下图:

图1. paddle 2.0 save结果形式的合理化与简化

image

图2. paddle 2.0 save结果整体变化表

image

本PR仅包含paddle.jit.save/load, paddle.load的改动,预测接口paddle.static.save/load_inference_model和高阶API接口paddle.Molde().save的改动需要由相关负责同学完成

三、TODO事项

paddle.static.save/load_inference_model的升级评审在9.28才完成,时间较为仓促。
但本次升级涉及的改动比较大,为了避免2.0正式版和2.0-RC在主推save/load接口使用上存在不兼容问题,假期内加班完成了paddle主repo中的接口改动,该PR的工作需要争取在2.0-RC切分支之前合入,剩余关联的辅助工作适当延后安排,具体包括:

  1. paddle.jit.save/load, paddle.load, paddle.SaveLoadConfig的中文文档的对应修改
  2. 指南文档【模型存储与载入】的修改完善
  3. 使paddle.jit.save/load, paddle.load在处理各个场景时的报错提示更加友好完善

四、英文文档预览

image

image

image

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

(1) model_filename (string): The inference model file name of the paddle 1.x ``save_inference_model``
save format. Default file name is :code:`__model__` .
(2) params_filename (string): The persistable variables file name of the paddle 1.x ``save_inference_model``
save format. No default file name, save variables separately by default.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't recommend users to use keep_name_table, only keep it for debuging, so don't write its doc.

Copy link

@saxon-zh saxon-zh 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
Collaborator

@phlrain phlrain 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

@chenwhql chenwhql merged commit 9b49f02 into PaddlePaddle:develop Oct 11, 2020
chen-zhiyu pushed a commit to chen-zhiyu/Paddle that referenced this pull request Oct 15, 2020
…dle#27623)

* replace config by kwargs

* change save path form dir to prefix

* fix failed unittests

* revert unittest name change

* polish en docs

* add more tests for coverage
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.

6 participants