Skip to content

Commit

Permalink
Make sure save_dir can be empty str (#15638)
Browse files Browse the repository at this point in the history
(cherry picked from commit c53dc20)
  • Loading branch information
tshu-w authored and Borda committed Nov 16, 2022
1 parent d10430a commit fafe429
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pytorch_lightning/callbacks/model_checkpoint.py
Expand Up @@ -574,7 +574,10 @@ def __resolve_ckpt_dir(self, trainer: "pl.Trainer") -> _PATH:
return self.dirpath

if len(trainer.loggers) > 0:
save_dir = trainer.loggers[0].save_dir or trainer.default_root_dir
if trainer.loggers[0].save_dir is not None:
save_dir = trainer.loggers[0].save_dir
else:
save_dir = trainer.default_root_dir
name = trainer.loggers[0].name
version = trainer.loggers[0].version
version = version if isinstance(version, str) else f"version_{version}"
Expand Down

0 comments on commit fafe429

Please sign in to comment.