Skip to content

Commit

Permalink
support sanity_val_step=-1
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed Jun 18, 2020
1 parent f8c10fb commit 8b50ecf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ def run_pretrain_routine(self, model: LightningModule):

# run tiny validation (if validation defined)
# to make sure program won't crash during val
if not self.disable_validation and self.num_sanity_val_steps > 0:
if not self.disable_validation and self.num_sanity_val_steps:
self.reset_val_dataloader(ref_model)

# hook and callback
Expand All @@ -1068,6 +1068,7 @@ def run_pretrain_routine(self, model: LightningModule):

num_loaders = len(self.val_dataloaders)
max_batches = [self.num_sanity_val_steps] * num_loaders
max_batches = [float('inf') for m in max_batches if m == -1]
eval_results = self._evaluate(model,
self.val_dataloaders,
max_batches,
Expand Down

0 comments on commit 8b50ecf

Please sign in to comment.