Subclasses of torch.utils.data.DataLoader are not supported
See original GitHub issueš Bug description
When using the Ignite engine with a subclass of torch.utils.data.DataLoader
, the engine re-instantiates the dataloader with its torch.utils.data.DataLoader
base class, if the DataLoaderās batch_sampler is not a ReproducibleBatchSampler
. See engine.py, line 874 in my version (call to _update_dataloader
).
This is super-dangerous, as people might not even notice that their custom DataLoader isnāt being used at all. Only found the issue because my custom DataLoader has some additional public members that arenāt parameters of the torch.utils.data.DataLoader
constructor, which is being called in _update_dataloader
.
Environment
- PyTorch Version: 1.4.0
- Ignite Version: 0.3.0
- OS: Linux
- How you installed Ignite: conda
- Python version: 3.7.6
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
torch.utils.data ā PyTorch 1.13 documentation
At the heart of PyTorch data loading utility is the torch.utils.data.DataLoader class. It represents a Python iterable over a dataset, with support for....
Read more >Complete Guide to the DataLoader Class in PyTorch
This post covers the PyTorch dataloader class. We'll show how to load built-in and custom datasets in PyTorch, plus how to transform and...
Read more >torch.utils.data.dataloader ā mmcv 1.3.3 documentation
Source code for torch.utils.data.dataloader. r"""Definition of the DataLoader and associated iterators that subclass _BaseDataLoaderIter To support theseĀ ...
Read more >PyTorch: How to use DataLoaders for custom Datasets
Dataset and torch.utils.data.DataLoader on your own data (not just the torchvision.datasets )?. Is there a way to use the inbuiltĀ ...
Read more >torch.utils.data.dataset ā Catalyst 20.02 documentation
To make it work with a map-style dataset with non-integral indices/keys, a custom sampler must ... When a subclass is used with :class:`~torch.utils.data....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To jump into this: wrapping the whole dataloader would be difficult I think, because then we would probably bypass the userās custom dataloader and directly use the dataset, which is also not wanted here.
IMO raising an exception is also not a good idea, since there are some userās (like me) who carefully designed their custom dataloader to work and behave as expected with ignite. Raising a warning and improving the docs would be the way to go IMO.
If the user wishes to use a custom dataloader, we should expect him to make it work as he wishes and therefore simply making him aware of that problem should be sufficient
Yes, you are right about the warning, thanks for that.
If you have an idea on how to improve that, we are happy to discuss and implement that š
You can also try our nightly releases with the latest features.