Skip to content

Trainer.validate(model, dataloader=dl) does not use passed dataloader  #8369

@jwallat

Description

@jwallat

🐛 Bug

I wanted to validate my model on a subset of the original validation set. I found the Trainer.validate() function which takes one or multiple dataloaders as one of its arguments. However, the model will use the model's default dataloader and not the one I passed to .validate().

Please reproduce using the BoringModel

https://colab.research.google.com/drive/1KMgKeugv9VqDgT4Mj8S-GObc8-3vS_H_?usp=sharing

To Reproduce

Run the colab example. You will see that despite passing another dataloader to trainer.validate(), it still uses the initial dataloader.

Expected behavior

If no new dataloader is passed to validate(), then it should use the existing dataloader of the model.
If a new dataloader is passed to validate(), then the passed dataloader should be used.

Environment

  • PyTorch Lightning Version (e.g., 1.3.8):
  • PyTorch Version (e.g., 1.8)
  • Python version:
  • OS (e.g., Linux):
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • How you installed PyTorch (conda, pip, source):
  • If compiling from source, the output of torch.__config__.show():
  • Any other relevant information:

Additional context

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedOpen to be worked onpriority: 0High priority taskwaiting on authorWaiting on user action, correction, or update

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions