Skip to content

Commit

Permalink
Do not use mtime for checkpoint rotation. (#28862)
Browse files Browse the repository at this point in the history
Resolve #26961
  • Loading branch information
xkszltl authored Feb 6, 2024
1 parent 0690116 commit ac51e59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2465,7 +2465,9 @@ def _save_checkpoint(self, model, trial, metrics=None):

# Maybe delete some older checkpoints.
if self.args.should_save:
self._rotate_checkpoints(use_mtime=True, output_dir=run_dir)
# Solely rely on numerical checkpoint id for rotation.
# mtime is not reliable especially on some fuse fs in cloud environments.
self._rotate_checkpoints(use_mtime=False, output_dir=run_dir)

self.args.distributed_state.wait_for_everyone()

Expand Down

0 comments on commit ac51e59

Please sign in to comment.