Skip to content

Commit

Permalink
Merge pull request #1162 from bghira/bugfix/rmtree-errors
Browse files Browse the repository at this point in the history
chore: ignore rmtree errors
  • Loading branch information
bghira authored Nov 16, 2024
2 parents 13799b6 + 12f1c16 commit ea620b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion helpers/training/save_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def _save_full_model(self, models, weights, output_dir):
shutil.copy2(s, d)

# Remove the temporary directory
shutil.rmtree(temporary_dir)
shutil.rmtree(temporary_dir, ignore_errors=True)

def save_model_hook(self, models, weights, output_dir):
# Write "training_state.json" to the output directory containing the training state
Expand Down
2 changes: 1 addition & 1 deletion helpers/training/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2717,7 +2717,7 @@ def train(self):
self.config.output_dir, removing_checkpoint
)
try:
shutil.rmtree(removing_checkpoint)
shutil.rmtree(removing_checkpoint, ignore_errors=True)
except Exception as e:
logger.error(
f"Failed to remove directory: {removing_checkpoint}"
Expand Down

0 comments on commit ea620b2

Please sign in to comment.