Run on_validation_end only on main process in DDP (#1125)
Co-authored-by: xingzhaolee <xingzhaolee@users.noreply.github.com>
This commit is contained in:
parent
b29613b758
commit
b4d4e489bf
|
@ -175,6 +175,10 @@ class ModelCheckpoint(Callback):
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue