How do I input text data into the model in lesson 4?

Hello everyone,

Does anyone know how to input text data (not imdb data, my own text data) into the model from lesson 4 https://github.com/fastai/fastai/blob/master/courses/dl1/lesson4-imdb.ipynb ? I want to input some text data that I have into the model and find out whether they are positive or negative. I have done every step in lesson 4 but got stuck at this last step.

Thank you all in advance!

Flo

You can call learn.predict(text) with text being what you want to test the model on. The learner should return the label (pos/neg), the class_id (0/1) and the softmax probabilities.

Hello How Khang,

Thank you so much for your reply! My file is currently in a csv format. Do you know how I can load it into the right format so that the learn.predict function will work?

Thank you again!
Flo

Hi,
I too have the same problem…
I was able to create a Language Model and was able to predict sentences, i have a CSV file which has 3 columns Text is in the 2nd column and my Label is in the 3rd column. When i am trying to build a classifier using the Language Model i built, i am not able to build a data bunch from my CSV file similar to IMDB classifier from folder which was discussed in today’s class. Can some one help me on this.

Thanks.