How to configure labels in the last layer of NLP model

After training the language model. I want to train the last layer with another data. In this case author identification from text. Therefore I need some way to tell the splits about label. I am assuming that we need to set this Label field with the label of prediction, but not sure how to pass the label in this case Author name to the dataset.

In IMDB example where are we mapping the sentiment label to the data?
IMDB_LABEL = data.Field(sequential=False)
splits =torchtext.datasets.IMDB.splits(TEXT, IMDB_LABEL, ‘data/’)

Check out this notebook for another dataset, and the cells following the heading “Classification model”

Also, once you get to the step of forming predictions, you may encounter another issue.

Read through this post, particularly the comment linked, for how to get predictions from your model

1 Like

Thanks so much Rob.

1 Like