Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions paddlenlp/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,16 +1607,13 @@ def _load_rng_state(self, checkpoint):
if os.path.isfile(rng_file):
rng_file_list = paddle.load(rng_file, return_numpy=True)
paddle.distributed.broadcast_object_list(rng_file_list, src=0)
# if rng_file_list still empty, then use old style rng_state
# if rng_file_list still empty, not log rng state.
if rng_file_list[0] is None:
rng_file = os.path.join(checkpoint, f"rng_state_{process_index}.pth")
if not os.path.isfile(rng_file):
logger.info(
f"Didn't find an RNG file for process {process_index}, if you are resuming a training that "
"wasn't launched in a distributed fashion, reproducibility is not guaranteed."
)
return
checkpoint_rng_state = paddle.load(rng_file, return_numpy=True)
logger.info(
f"Didn't find an RNG file for process {process_index}, if you are resuming a training that "
"wasn't launched in a distributed fashion, reproducibility is not guaranteed."
)
return
else:
checkpoint_rng_state = rng_file_list[process_index]
else:
Expand Down