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

Division by zero when training with small datasets caused by incomplete batch dropping #228

Open
iboates opened this issue Apr 16, 2023 · 0 comments

Comments

@iboates
Copy link

iboates commented Apr 16, 2023

I am aware that this repo is no longer maintained but I recently had to blow the dust off of it to replicate some stuff I did a few years ago. When setting up the environment I kept getting a division by 0 here. I finally resolved it and thought I should leave a note here in case anyone finds themself in a similar situation.

It turns out it was because I was using a trivially small datasetr (only a few features) because I was just trying to get the entire pipeline working correctly. Specifically, when initializing the DataLoaders, the drop_last parameter is hardcoded to True, which will always drop the last batch if it is incomplete. So if you only have one (tiny) batch, you end up with an empty data loader, causing the aforementioned division by zero error.

Change this parameter to False here and here to fix it.

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