ImageDataBunch.single_from_classes says training and valid sets are empty

I was following along with the v3 course videos, and this part about inference has been troubling me for a while.

This is the line:

data2 = ImageDataBunch.single_from_classes(path, classes, tfms=get_transforms(), size=224).normalize(imagenet_stats)

The path is the same path which I used for the first DataBunch which was from_folder. It works without issues there. The classes, transforms, size and normalization is the same as the original data.

Not sure what I’m doing wrong here.

This is the error:

/home/ubuntu/anaconda3/lib/python3.6/site-packages/fastai/data_block.py:388: UserWarning: Your training set is empty. Is this is by design, pass ignore_empty=True to remove this warning.
warn(“Your training set is empty. Is this is by design, pass ignore_empty=True to remove this warning.”)
/home/ubuntu/anaconda3/lib/python3.6/site-packages/fastai/data_block.py:391: UserWarning: Your validation set is empty. Is this is by design, use no_split()
or pass ignore_empty=True when labelling to remove this warning.
or pass ignore_empty=True when labelling to remove this warning.""")

Any help would be appreciated.

I just pushed a fix for this in master. Note that there is an easier way now, using learn.export() and load_learner.

Thanks for the fix.

However the new method you mentioned learn.export doesn’t work on my paperspace machine. I checked by doing git pull and everything seems to be updated.

It gives me this error:

AttributeError Traceback (most recent call last)
in
----> 1 learner.export()
AttributeError: ‘Learner’ object has no attribute ‘export’

You need a developer install as it’s only in master for now, or wait a little bit more for v1.0.40 (normally later today).

Ah I see. I’ll wait for the update.

Hi @sgugger, has this been updated?

v1.0.40 (normally later today)

I am still getting the same error with non dev install. Thanks

Yes, the latest is 1.0.41

I’m also getting this error running on Crestle today. Everything seems to be up to date. Any idea what I should do?

1 Like

It isn’t up to date. You can check your version with

from fastai.utils.show_install import *
show_install()

ModuleNotFoundError: No module named ‘fastai.utils.show_install’