-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Labels
bugSomething isn't workingSomething isn't workingloopsRelated to the Loop APIRelated to the Loop API
Milestone
Description
🐛 Bug
If you have a list of dataloaders (used in a continual learning setting) and check_val_every_n_epoch
in the trainer is not equal to 1 then validation_step()
won't return the index of the dataloader currently being used.
To Reproduce
Dataloader for validation:
def val_dataloader(self):
return [DataLoader(ds, batch_size=self.batch_size, shuffle=True , num_workers=self.num_workers) for ds in self.test_datasets[:self.curr_index+1]]
Validation step:
def validation_step(self, val_batch, batch_idx, dataloader_idx=None):
if dataloader_idx:
print("data loader index provided")
Run this in a training loop with check_val_every_n_epoch=1
and compare to check_val_every_n_epoch=5
. The latter will always have dataloader_idx=None
.
Expected behavior
The dataloader_idx is always correctly provided independently of how often the validation is called.
Environment
- PyTorch Lightning Version (e.g., 1.5.0): 1.5.4
- PyTorch Version (e.g., 1.10): 1.10.0 py3.8_cuda10.2_cudnn7.6.5_0
- Python version (e.g., 3.9): 3.8.3
- OS (e.g., Linux): Linux
- CUDA/cuDNN version: 10.1
- GPU models and configuration: v100
- How you installed PyTorch (
conda
,pip
, source): conda
Additional context
Thanks.
cc @carmocca @justusschock @ananthsub @ninginthecloud @rohitgr7
Metadata
Metadata
Labels
bugSomething isn't workingSomething isn't workingloopsRelated to the Loop APIRelated to the Loop API