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

Gap in IndexBatchSamplerWrapper check for dataloaders used for prediction #9425

Closed
ananthsub opened this issue Sep 10, 2021 · 0 comments · Fixed by #9432
Closed

Gap in IndexBatchSamplerWrapper check for dataloaders used for prediction #9425

ananthsub opened this issue Sep 10, 2021 · 0 comments · Fixed by #9432
Assignees
Labels
bug Something isn't working help wanted Open to be worked on

Comments

@ananthsub
Copy link
Contributor

ananthsub commented Sep 10, 2021

🐛 Bug

Carrying forward the discussion here: #9380 (comment)

The Trainer is currently inconsistent around checks for batch samplers. This code first checks if the dataloader has a batch sampler before applying the wrapper for prediction. https://github.com/PyTorchLightning/pytorch-lightning/blob/8407238d66df14c4476f880a6e6260b4bfa83b40/pytorch_lightning/trainer/data_loading.py#L161-L171

But this code in the prediction loop unconditionally accesses the attribute: https://github.com/PyTorchLightning/pytorch-lightning/blob/8407238d66df14c4476f880a6e6260b4bfa83b40/pytorch_lightning/loops/epoch/prediction_epoch_loop.py#L163-L164

This means if for any reason the IndexBatchSamplerWrapper wasn't applied, this access will fail.

Proposal for fix:

cc @ninginthecloud as this might occur when using iterables with the trainer

To Reproduce

Expected behavior

Environment

  • PyTorch Lightning Version (e.g., 1.3.0):
  • 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

@ananthsub ananthsub added bug Something isn't working help wanted Open to be worked on labels Sep 10, 2021
@ananthsub ananthsub self-assigned this Sep 10, 2021
@tchaton tchaton self-assigned this Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Open to be worked on
Projects
None yet
2 participants