Make sure save_dir can be empty str (#15638)

This commit is contained in:
Tianshu Wang 2022-11-11 19:21:22 +08:00 committed by GitHub
parent 164e5a7b3e
commit c53dc205ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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}"