Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inadequate total steps shown in progress bar during sanity validation check when number of validation dataloaders >= 2 #586

Closed
YehCF opened this issue Dec 5, 2019 · 2 comments · Fixed by #597
Labels
bug Something isn't working

Comments

@YehCF
Copy link
Contributor

YehCF commented Dec 5, 2019

Describe the bug
The number of total steps shown in progress bar during validation sanity check is underestimated when multiple validation dataloaders are provided.

To Reproduce
Steps to reproduce the behavior:

  1. At def val_dataloader(self), return a list of >= 2 validation dataloaders.
    e.g. return [val_dataloader1, val_dataloader2]
  2. Set nb_sanity_val_steps for trainer to n (default n = 5)
  3. Run experiment

Expected behavior

  1. If two validation dataloaders are provided, the total steps shown in progress bar during validation sanity check are n * 2. That is, 10 steps shown progress bar.

In current master - trainer.py

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,
                             leave=False, position=2 * self.process_position,
                             disable=not self.show_progress_bar, dynamic_ncols=True, unit='batch')

Should be modified to

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*len(self.get_val_dataloaders()),
                             leave=False, position=2 * self.process_position,
                             disable=not self.show_progress_bar, dynamic_ncols=True, unit='batch')
@YehCF YehCF added the bug Something isn't working label Dec 5, 2019
@neggert
Copy link
Contributor

neggert commented Dec 5, 2019

Can confirm this. I've been seeing it (and ignoring it), but I never made the connection that it was because I was using two dataloaders.

Since it seems you've already figured out the fix, could you submit a PR?

@YehCF
Copy link
Contributor Author

YehCF commented Dec 6, 2019

Sure. Already submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants