Error when using TabularDataLoaders without any continuous variables

I have a tabular dataset, all with categorical variables, trying to perform a binary classification.

When I don’t pass in any cont_names to TabularDataLoaders.from_csv, I get the following error:

TypeError: Object with dtype category cannot perform the numpy op subtract

A potential workaround is to pass an empty list as cont_names (e.g. cont_names=[]). It sort of works, but adds an extra empty tensor in each batch, causing some issues with the custom dataloaders I’m trying to use.

To reproduce the error, run through the Tabular training tutorial notebook, removing the cont_names argument, e.g.:

from fastai2.tabular.all import *
path = untar_data(URLs.ADULT_SAMPLE)
df = pd.read_csv(path/'adult.csv')
dls = TabularDataLoaders.from_csv(path/'adult.csv', path=path, y_names="salary",
    cat_names = ['workclass', 'education', 'marital-status', 'occupation', 'relationship', 'race'],
    procs = [Categorify, FillMissing, Normalize])

Using fastai2 0.0.21 installed with pip.

same problem here. It’s a bug.