Created by: chenwhql
PR types
New features
PR changes
APIs
Describe
【兼容升级】This PR supprot loading state_dict
from save_inference_model
save result.
This is an important feature, and we often see related problems in issues. After we switched from static graph mode to dynamic graph mode, many users rewritten the dynamic graph model code and needed to load from the result of save_inferenece_model
in original static graph model, such as: https://github.com/PaddlePaddle/Paddle/issues/26519
API changes:
-
paddle.load(model_path, keep_name_table=False)
->paddle.load(model_path, configs=None)
: add decoratordeprecate_keep_name_table
for compatibility -
paddle.jit.SaveLoadConfig
->paddle.SaveLoadConfig
: becausepaddle.load
also use it, move it to paddle module,SaveLoadConfig
is a class for two save format's compatibility, not only a jit related class - add
paddle.SaveLoadConfig.keep_name_table
: for compatible with oldpaddle.load(model_path, keep_name_table=False)
After this PR, the Paddle 2.0 Save/Load inferfaces are like follow:
This PR creates the green line
in graph.
Doc change
related PR: https://github.com/PaddlePaddle/FluidDoc/pull/2531