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

Error: batch_size should be a positive integer value, but got batch_size=0 #40

Open
lweingart opened this issue Jan 6, 2024 · 1 comment

Comments

@lweingart
Copy link

Hello guys,

Thank you very much for your work.
I'm trying to train my model based on my own dataset, but when running the training command it always fails with the following error:

File "/home/ubuntu/git/stylegan-v/env-ampere/lib/python3.9/site-packages/torch/utils/data/sampler.py", line 215, in __init__
    raise ValueError("batch_size should be a positive integer value, "
ValueError: batch_size should be a positive integer value, but got batch_size=0

Even if I try to specify the batch size in the command by adding training.batch_size=8 for instance, it keeps failing with the same error message.

The command I use is:

python src/infra/launch.py hydra.run.dir=test_rundir exp_suffix=test_exp env=raven-local dataset=ffs dataset.resolution=512 num_gpus=2 training.batch_size=8

Would someone have any idea what I should do to get around this please?
Thank you very much for your help in advance.

Cheers

@lweingart
Copy link
Author

High again,

So, I realised that I have this issue when I use my dataset with a 512 resolution.
If I use the exact same dataset but with a resolution of 256, it works.
It makes no sense to me. I printed out the value of batch_size in the sampler.py file and the value is changing at each training iteration.
For some reason it works at a resolution of 256, but when the resolution is at 512, the batch_size turns to 0.
I'm specifying the training.batch_size value when running the training command, and it is correctly written in the experiment_confog.yaml file.

I'm at a complete loss as to how I could train my model with a dataset at a 512 resolution.
Would anyone have any idea please ?

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant