fastai / fastai_dev

fast.ai early development experiments
Apache License 2.0
641 stars 351 forks source link

is_showable should return false on empty lists #245

Closed bearpelican closed 5 years ago

bearpelican commented 5 years ago

_is_showable returns True on an empty list and returns early from Pipeline decode transformation. This isn't always ideal, because empty lists cannot be shown. We should give the other Transforms a chance to handle an empty list.

Ran into this error while decoding an empty MultiCategory class

Culprit: all([]) returns true.

review-notebook-app[bot] commented 5 years ago

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

sgugger commented 5 years ago

I'm not sure what the use case is: if you have an empty tuple of things, the other transforms (that are very often applied over the tuple) will keep returning it empty. Could you provide an example of use?

bearpelican commented 5 years ago

Yup you are right. This was to fix an earlier bug that happened in MultiCategorize +OneHotEncode.

https://github.com/fastai/fastai_dev/pull/246 should be a better fix