Skip to content

Commit

Permalink
Update trainer.py (#8117)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZHUI authored Mar 14, 2024
1 parent 0a39fbf commit 5fdc3c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion paddlenlp/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2305,7 +2305,8 @@ def _rotate_checkpoints(self, use_mtime=False, output_dir=None) -> None:
checkpoints_to_be_deleted = checkpoints_sorted[:number_of_checkpoints_to_delete]
for checkpoint in checkpoints_to_be_deleted:
logger.info(f"Deleting older checkpoint [{checkpoint}] due to args.save_total_limit")
shutil.rmtree(checkpoint)
# ignore_errors for shared disks between train nodes.
shutil.rmtree(checkpoint, ignore_errors=True)

def _save(self, output_dir: Optional[str] = None, state_dict=None, merge_tensor_parallel=False):
output_dir = output_dir if output_dir is not None else self.args.output_dir
Expand Down

0 comments on commit 5fdc3c2

Please sign in to comment.