Skip to content

Commit

Permalink
Add ignore_errors=True to trainer.py rmtree in _inner_training_loop (#…
Browse files Browse the repository at this point in the history
…31668)

Update trainer.py
  • Loading branch information
njbrake authored Jul 3, 2024
1 parent ddfaf11 commit 65a02cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,7 @@ def _inner_training_loop(
for checkpoint in checkpoints_sorted:
if not os.path.samefile(checkpoint, self.state.best_model_checkpoint):
logger.info(f"Deleting older checkpoint [{checkpoint}] due to args.save_total_limit")
shutil.rmtree(checkpoint)
shutil.rmtree(checkpoint, ignore_errors=True)

self.control = self.callback_handler.on_train_end(args, self.state, self.control)

Expand Down

0 comments on commit 65a02cd

Please sign in to comment.