From cbd2b6f1dc46b0b9eec18149d72a8be023b1c7df Mon Sep 17 00:00:00 2001 From: omorim Date: Wed, 28 Aug 2024 13:58:56 -0700 Subject: [PATCH] no gradient val test --- model.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/model.py b/model.py index acaa98c0..97eb7a8c 100644 --- a/model.py +++ b/model.py @@ -322,10 +322,12 @@ def training_step(self, batch, batch_idx): return self.step_(batch, batch_idx, 'train_loss') def validation_step(self, batch, batch_idx): - self.step_(batch, batch_idx, 'val_loss') + with torch.no_grad(): + self.step_(batch, batch_idx, 'val_loss') def test_step(self, batch, batch_idx): - self.step_(batch, batch_idx, 'test_loss') + with torch.no_grad(): + self.step_(batch, batch_idx, 'test_loss') def configure_optimizers(self): LR = self.lr