Skip to content

Commit

Permalink
Encourage resetting all validation metrics when training starts (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleve authored Feb 25, 2023
1 parent 81fafde commit 745b37b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/models/mnist_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def forward(self, x: torch.Tensor):

def on_train_start(self):
# by default lightning executes validation step sanity checks before training starts,
# so we need to make sure val_acc_best doesn't store accuracy from these checks
# so it's worth to make sure validation metrics don't store results from these checks
self.val_loss.reset()
self.val_acc.reset()
self.val_acc_best.reset()

def model_step(self, batch: Any):
Expand Down

0 comments on commit 745b37b

Please sign in to comment.