Skip to content

Commit

Permalink
[REF] Use exist_ok=True
Browse files Browse the repository at this point in the history
  • Loading branch information
f-dangel committed Aug 29, 2024
1 parent f1e4f81 commit 59bf40e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions wandb_preempt/checkpointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ def checkpoint_path(self, epoch: int) -> str:
The path to the checkpoint file for this epoch.
"""
checkpoint_dir = path.join(self.savedir, environ["SLURM_ARRAY_JOB_ID"])
if not path.exists(checkpoint_dir):
makedirs(checkpoint_dir)
makedirs(checkpoint_dir, exist_ok=True)
return path.join(checkpoint_dir, f"{self.run_id}_epoch_{epoch:08g}.pt")

def save_checkpoint(self, epoch: int) -> None:
Expand Down

0 comments on commit 59bf40e

Please sign in to comment.