robosat icon indicating copy to clipboard operation
robosat copied to clipboard

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

Open iboates opened this issue 2 years ago • 0 comments

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.

iboates avatar Apr 16 '23 14:04 iboates