Skip to content

Commit

Permalink
Fix number of total steps shown in progress bar during sanity validat…
Browse files Browse the repository at this point in the history
…ion check when number of validation dataloaders >= 2 (#597)

* type: debug

Calculate the adequate number of steps to run during sanity_check.
This fixes the bug when there are two or more validation dataloaders.

- Before: total=self.num_sanity_val_steps
- After: total=self.num_sanity_val_steps*len(self.get_val_dataloaders())

* type: refactor

Put total=... in the next line

* type: refactor

run flake8
  • Loading branch information
YehCF authored and williamFalcon committed Dec 7, 2019
1 parent 0489e31 commit cc65f39
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 @@ -491,7 +491,8 @@ def run_pretrain_routine(self, model):
ref_model.on_sanity_check_start()
if self.get_val_dataloaders() is not None and self.num_sanity_val_steps > 0:
# init progress bars for validation sanity check
pbar = tqdm.tqdm(desc='Validation sanity check', total=self.num_sanity_val_steps,
pbar = tqdm.tqdm(desc='Validation sanity check',
total=self.num_sanity_val_steps * len(self.get_val_dataloaders()),
leave=False, position=2 * self.process_position,
disable=not self.show_progress_bar, dynamic_ncols=True, unit='batch')
self.main_progress_bar = pbar
Expand Down

0 comments on commit cc65f39

Please sign in to comment.