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

'CombinedLoader' object has no attribute 'batch_sampler' when using a CombinedLoader in predict_dataloader #11062

Closed
franciscojferrari opened this issue Dec 14, 2021 · 4 comments · Fixed by #11111
Labels
bug Something isn't working data handling Generic data-related topic
Milestone

Comments

@franciscojferrari
Copy link

franciscojferrari commented Dec 14, 2021

🐛 Bug

When returning a CombinedLoader with a dictionary in a predict_dataloader throws AttributeError: 'CombinedLoader' object has no attribute 'batch_sampler'

predict_dataloader should behave the same as test_dataloader where this behavior doesn't happen in order to be consistent between dataloaders

To Reproduce

Please check colab link : https://colab.research.google.com/drive/1EUc_SoomMTNw148xo4Szvozh4tJwkWC1?usp=sharing

Expected behavior

predict_dataloader should behave the same as test_dataloader where this behavior doesn't happen in order to be consistent between dataloaders

Environment

  • CUDA:
    - GPU:
    - Tesla P100-PCIE-16GB
    - available: True
    - version: 11.1* Packages:
    - numpy: 1.19.5
    - pyTorch_debug: False
    - pyTorch_version: 1.10.0+cu111
    - pytorch-lightning: 1.5.5
    - tqdm: 4.62.3
  • System:
    - OS: Linux
    - architecture:
    - 64bit
    -
    - processor: x86_64
    - python: 3.7.12
    - version: Proposal for help #1 SMP Sat Jun 5 09:50:34 PDT 2021

Additional context

cc @justusschock @awaelchli @ninginthecloud

@franciscojferrari franciscojferrari added the bug Something isn't working label Dec 14, 2021
@rohitgr7 rohitgr7 added this to the 1.5.x milestone Dec 14, 2021
@rohitgr7 rohitgr7 added the data handling Generic data-related topic label Dec 14, 2021
@awaelchli
Copy link
Contributor

The issue here boils down to us having to ensemble a batch sampler for a combined dataloader (holding dataloaders of which a subset have batch samplers). This issue occurs mainly because in the prediction we require a batch sampler to keep track of the indices of each sample.

@rohitgr7
Copy link
Contributor

should we drop support for combinedLoader during prediction, because of the incompatibility?

@justusschock
Copy link
Member

I am not convinced that this would be the way to go. I talked to @awaelchli yesterday about different ways to make this possible. A hotfix would be to make the attribute access optional.

For a longterm solution we probably need to revisit the loader itself, but we should not drop support I think

@awaelchli
Copy link
Contributor

I'll send that hotfix since I modified this code recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working data handling Generic data-related topic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants