Skip to content

Commit

Permalink
Run on_validation_end only on main process in DDP (#1125)
Browse files Browse the repository at this point in the history
Co-authored-by: xingzhaolee <xingzhaolee@users.noreply.github.com>
  • Loading branch information
Xing Zhao LEE and xingzhaolee authored Mar 12, 2020
1 parent b29613b commit b4d4e48
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pytorch_lightning/callbacks/model_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ def format_checkpoint_name(self, epoch, metrics, ver=None):
return filepath

def on_validation_end(self, trainer, pl_module):
# only run on main process
if trainer.proc_rank != 0:
return

metrics = trainer.callback_metrics
epoch = trainer.current_epoch
self.epochs_since_last_check += 1
Expand Down

0 comments on commit b4d4e48

Please sign in to comment.