Skip to content

Commit

Permalink
use gfile to support remote directories
Browse files Browse the repository at this point in the history
  • Loading branch information
f4hy committed Jun 13, 2020
1 parent f6b6ff4 commit 6dcc9e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pytorch_lightning/callbacks/model_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __init__(self, filepath: Optional[str] = None, monitor: str = 'val_loss', ve
save_last: bool = False, save_top_k: int = 1, save_weights_only: bool = False,
mode: str = 'auto', period: int = 1, prefix: str = ''):
super().__init__()
if save_top_k > 0 and filepath is not None and tf.io.gfile.isdir(filepath) and len(os.listdir(filepath)) > 0:
if save_top_k > 0 and filepath is not None and tf.io.gfile.isdir(filepath) and len(tf.io.gfile.listdir(filepath)) > 0:
rank_zero_warn(
f"Checkpoint directory {filepath} exists and is not empty with save_top_k != 0."
"All files in this directory will be deleted when a checkpoint is saved!"
Expand Down

0 comments on commit 6dcc9e6

Please sign in to comment.