diff --git a/doc/fluid/beginners_guide/coding_practice/save_load_variables.rst b/doc/fluid/beginners_guide/coding_practice/save_load_variables.rst index 40bb9b4841005dceab3dcbc0c5b67c15ee68d427..6ce016d84eb8fded69675d4689fb684527ed608e 100644 --- a/doc/fluid/beginners_guide/coding_practice/save_load_variables.rst +++ b/doc/fluid/beginners_guide/coding_practice/save_load_variables.rst @@ -204,8 +204,8 @@ save_vars、save_params、save_persistables 以及 save_inference_model的区别 path = "./models" startup_prog = fluid.default_startup_program() exe.run(startup_prog) + fluid.io.load_persistables(exe, path, startup_prog) main_prog = fluid.default_main_program() - fluid.io.load_persistables(exe, path, main_prog) exe.run(main_prog) 上面的例子中,通过调用 :code:`fluid.io.load_persistables` 函数,PaddlePaddle Fluid会从默认 diff --git a/doc/fluid/beginners_guide/coding_practice/save_load_variables_en.rst b/doc/fluid/beginners_guide/coding_practice/save_load_variables_en.rst index 7d987087fa55a69719ea3557023504b6237182ba..7130cb03b579dd97ad64f02aa401ebd188047393 100644 --- a/doc/fluid/beginners_guide/coding_practice/save_load_variables_en.rst +++ b/doc/fluid/beginners_guide/coding_practice/save_load_variables_en.rst @@ -27,23 +27,6 @@ How to save model variables The model variables we need to save are different depending on the application. For example, if we just want to save the model for future predictions, just saving the model parameters will be enough. But if we need to save a checkpoint for future recovery of current training, then we should save all the persistable variables, and even record the current epoch and step id. It is because even though some model variables are not parameters, they are still essential for model training. - -Difference between save_vars、save_params、save_persistables and save_inference_model -########################################################################## -1. :code:`save_inference_model` will prune the inference model based on :code:`feeded_var_names` and :code:`target_vars` , this method will save the ``__model__`` file of the pruned program and the persistable variables in the program. - -2. :code:`save_persistables` this method will not save model, it will save all the persistable variables in the program. - -3. :code:`save_params` this method will not save model, it will save all the parameters in the program. - -4. :code:`save_vars` this method will not save model, it will save the given parameter by user. - - :code:`save_persistables` this method is useful for increment training or checkpoint training, it can save persistable variables in program comprehensively, such as parameter variables, optimizer variables, if you need increment training or checkpoint training, please choose this one. - :code:`save_inference_model` this method is useful for inference, it will save persistable variables and pruned program, if you need program and variables for follow-up high performance inference, please choose this one. - - :code:`save_vars 和 save_params` there methods are only needed in particular cases, we suppose you already know the purpose of there APIs, there are not recommended for use normally. - - Save the model to make prediction for new samples =================================================== @@ -143,8 +126,8 @@ In the above example, by calling the :code:`fluid.io.save_persistables` function path = "./models" startup_prog = fluid.default_startup_program() exe.run(startup_prog) + fluid.io.load_persistables(exe, path, startup_prog) main_prog = fluid.default_main_program() - fluid.io.load_persistables(exe, path, main_prog) exe.run(main_prog) In the above example, by calling the :code:`fluid.io.load_persistables` function, PaddlePaddle Fluid will find persistable variables from all model variables in the default :code:`fluid.Program` , e.t. :code:`prog` . and load them one by one from the specified :code:`path` directory to continue training. diff --git a/doc/paddle/api/paddle/distributed/fleet/Fleet_cn.rst b/doc/paddle/api/paddle/distributed/fleet/Fleet_cn.rst index 5af3d0db84032aa1c112b04deb8e6353a8d424f7..228829950bed3ac20c35271bf5bdfc909137fe29 100644 --- a/doc/paddle/api/paddle/distributed/fleet/Fleet_cn.rst +++ b/doc/paddle/api/paddle/distributed/fleet/Fleet_cn.rst @@ -40,7 +40,7 @@ Fleet是飞桨分布式训练统一API, 只需要import fleet并简单初始化 .. code-block:: python import paddle.distributed.fleet as fleet - role = fleet.PaddleCloudRoleMaker + role = fleet.PaddleCloudRoleMaker() fleet.init(role)