How to perform textdatabunch on test dataset

I had pretrained a model for sentiment analysis, but to use that model for other dataset, need to perform TextLMDataBunch operation. But while using the standard code( given below) it shows an error : from_df() missing 1 required positional argument: ‘valid_df’

data_test = TextLMDataBunch.from_df(Path(path), test_df, text_cols=‘text’, bs=32)

Need help in how can I transform the test dataset.

Based on the details you provided you need to create a TextClasDatabunch and not TextLMDataBunch . The latter one is used for creating a databunch for the language model which basically guesses the next word in a sentence. You’re required to pass a seperate df for the validation set to both these classes. You can also use TextList instead which is much more customizable.

I tried doing that, but wasn’t able to predict further after creating textlist. If you can help in that part.

post the part of code where you’re creating the databunch