From c53dc205ed0c1911295a2f741781920b840808d7 Mon Sep 17 00:00:00 2001 From: Tianshu Wang Date: Fri, 11 Nov 2022 19:21:22 +0800 Subject: [PATCH] Make sure save_dir can be empty str (#15638) --- src/pytorch_lightning/callbacks/model_checkpoint.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pytorch_lightning/callbacks/model_checkpoint.py b/src/pytorch_lightning/callbacks/model_checkpoint.py index 1403b754be..85c6e1aac6 100644 --- a/src/pytorch_lightning/callbacks/model_checkpoint.py +++ b/src/pytorch_lightning/callbacks/model_checkpoint.py @@ -584,7 +584,10 @@ class ModelCheckpoint(Checkpoint): 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}"