Skip to content

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

@YehCF

Description

@YehCF

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') 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions