Fix number of total steps shown in progress bar during sanity validation 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
This commit is contained in:
YehCF
2019-12-07 08:47:59 -05:00
committed by William Falcon
parent 0489e31b02
commit cc65f39d97
+2 -1
View File
@@ -491,7 +491,8 @@ class Trainer(TrainerIOMixin,
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