Auto dataloader - ValueError: batch_size should be a positive integer value, but got batch_size=0
See original GitHub issue🐛 Bug description
The following code will brake if batch_size
is smaller than world size :
import torch
import ignite.distributed as idist
def foo(i):
data = torch.arange(100).reshape(25, 4)
data_loader = idist.auto_dataloader(data, batch_size=6, num_workers=12)
if __name__ == "__main__":
idist.spawn("gloo", foo, args=(), nproc_per_node=8)
ValueError: batch_size should be a positive integer value, but got batch_size=0
A fix can be:
- keep batch size as provided if smaller than world size
- same for
num_workers
Environment
- PyTorch Version (e.g., 1.4): 1.5.0
- Ignite Version (e.g., 0.3.0): master
- OS (e.g., Linux): linux
- How you installed Ignite (
conda
,pip
, source): - Python version: 3.7
- Any other relevant information:
@InCogNiTo124 would you like to fix this as you recently played around auto_*
?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
ValueError: batch_size should be a positive integer value
Any idea what is causing this error message. “ValueError: batch_size should be a positive integer value, but got batch_size=Compose(
Read more >ValueError: num_samples should be a positive integer ...
I have the error of the title ValueError: num_samples should be a positive integer value, but got num_samples=0 because basically I am ...
Read more >PyTorch Dataloader Overview (batch_size, shuffle ...
Automatic data shuffling. In this tutorial, you will review several common examples of how to use Dataloaders and explore settings including dataset, batch_size...
Read more >Source code for pytorch_forecasting.data.timeseries
Timeseries datasets. Timeseries data is special and has to be processed and fed to algorithms in a special way. This module defines a...
Read more >tf.data.Dataset | TensorFlow v2.11.0
Once you have a dataset, you can apply transformations to prepare the data for ... if batch_size does not divide the number of...
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
@vfdev-5 alright, I’ll let you know if I can’t fix it by then 😃
@InCogNiTo124 yes, you are correct about that: 6 // 8 = 0
And yes, it is a typo. I fixed it.