Error when adding in a test set via "add_test"

This …

data_clas = (TextList
             .from_df(train_df, path=path, col=['text'], processor=txt_proc)
             .random_split_by_pct(valid_pct=.2)
             .label_from_df(cols=['target'])
             .add_test(TextList.from_df(test_df, path, col=['text']))
             .databunch(bs=50)
            )

… fails when training the model but works fine when I remove the test DataFrame.

learn.fit_one_cycle(1, 3e-2, moms=(0.8,0.7))

Error:

I may be formulating my Data Block API code wrong so if anyone can help, much appreciated.

2 Likes

You should pull the latest code. I just submitted a fix for this last night.

2 Likes

Thanks!

Is it in the repo or latest release build?

Thanks, I’ve been struggling with this error too when the test set is bigger than the validation set.