Skip to content

Commit

Permalink
Set sync_dist=True when logging best so far validation accuracy (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleve authored May 2, 2023
1 parent 1bffe79 commit 334271d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/models/mnist_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def on_validation_epoch_end(self):
self.val_acc_best(acc) # update best so far val acc
# log `val_acc_best` as a value through `.compute()` method, instead of as a metric object
# otherwise metric would be reset by lightning after each epoch
self.log("val/acc_best", self.val_acc_best.compute(), prog_bar=True)
self.log("val/acc_best", self.val_acc_best.compute(), sync_dist=True, prog_bar=True)

def test_step(self, batch: Any, batch_idx: int):
loss, preds, targets = self.model_step(batch)
Expand Down

0 comments on commit 334271d

Please sign in to comment.