mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
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:
co-authored by
xingzhaolee
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
|
||||
|
||||
Reference in New Issue
Block a user