Skip to content

Commit

Permalink
enable fast_dev_run without a validation loop (#1779)
Browse files Browse the repository at this point in the history
* fix val dataloader

* Update evaluation_loop.py
  • Loading branch information
williamFalcon committed May 11, 2020
1 parent 88c086b commit eeb4111
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pytorch_lightning/callbacks/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def total_val_batches(self) -> int:
"""
trainer = self.trainer
total_val_batches = 0
if trainer.fast_dev_run:
if trainer.fast_dev_run and trainer.val_dataloaders is not None:
total_val_batches = len(trainer.val_dataloaders)
elif not self.trainer.disable_validation:
is_val_epoch = (trainer.current_epoch + 1) % trainer.check_val_every_n_epoch == 0
Expand Down
4 changes: 4 additions & 0 deletions pytorch_lightning/trainer/evaluation_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ def run_evaluation(self, test_mode: bool = False):
dataloaders = self.val_dataloaders
max_batches = self.num_val_batches

# enable fast_dev_run without val loop
if dataloaders is None:
return

# cap max batches to 1 when using fast_dev_run
if self.fast_dev_run:
max_batches = 1
Expand Down

0 comments on commit eeb4111

Please sign in to comment.