keras icon indicating copy to clipboard operation
keras copied to clipboard

Progress bar crash when empty dataset

Open stridge-cruxml opened this issue 1 year ago • 4 comments

I accidentally filtered out all examples and tried to evaluate on an empty dataset. Was getting a confusing crash in the progress bar code as self.target == 0.

See here

stridge-cruxml avatar May 08 '24 00:05 stridge-cruxml

Could you please share an example to reproduce the reported behavior. Thanks

sachinprasadhs avatar May 08 '24 05:05 sachinprasadhs

So self.target was set to 0 in keras/src/utils/progbar.py, as i passed in a dataset with all examples filtered out :face_exhaling:.

numdigits = int(math.log10(self.target)) + 1 then tries to take log of 0.

stridge-cruxml avatar May 20 '24 00:05 stridge-cruxml

Hi @stridge-cruxml, I don't think throwing an error is unreasonable in this situation. What behavior would you expect from Keras?

grasskin avatar May 29 '24 15:05 grasskin

I think just a warning "dataset is empty"?

I can imagine some complicated thing where someone filters different examples each epoch. The rest of the code doesn't seem to mind empty datasets.

stridge-cruxml avatar May 29 '24 21:05 stridge-cruxml