diff --git a/paddle/fluid/operators/checkpoint_load_op.cc b/paddle/fluid/operators/checkpoint_load_op.cc index 82a40e18d5c9e5748eac8eb454257e8598d6bdc4..c18edf63062044970a0ceb0385962546d43356c4 100644 --- a/paddle/fluid/operators/checkpoint_load_op.cc +++ b/paddle/fluid/operators/checkpoint_load_op.cc @@ -176,7 +176,7 @@ to a file on disk. AddAttr( "dir", "(string)" - "The \"file_path\" where the LoDTensor variables will be saved.") + "The \"dir\" where the checkpoint files will be loaded.") .AddCustomChecker( [](const std::string &path) { return !path.empty(); }); } diff --git a/paddle/fluid/operators/checkpoint_save_op.cc b/paddle/fluid/operators/checkpoint_save_op.cc index 790fd4ea68505a306872290cadb71319038ad965..1832c5792a18c7c65e689cd2b0d20df60ddfdd43 100644 --- a/paddle/fluid/operators/checkpoint_save_op.cc +++ b/paddle/fluid/operators/checkpoint_save_op.cc @@ -94,10 +94,16 @@ class CheckpointSaveOp : public framework::OperatorBase { VLOG(1) << "CheckpointSaveOp get " << SERIAL_VAR << " value: " << serial_num; - if (serial_num->empty()) { - serial_num->append("0"); + int serials = 0; + if (!serial_num->empty()) { + std::string::size_type sz; + serials = std::stoi(serial_num->data, &sz); + serials += 1; } + serial_num->clear(); + serial_num->append(std::to_string(serials)); + std::string dir = GenePath(ck_dir, serial_num->c_str()); VLOG(1) << "CheckpointSaveOp current dir: " << dir; bool is_present = FileExists(dir);