How to specify number of target classes for TFRobertaSequenceClassification?

Viewed 375

I have a text classification task at hand and I want to use roberta pre-trained model from transformers library.

Here's the docs : TFRobertaForSequenceClassification

As per the documentation to train we have to use,

from transformers import RobertaTokenizer, TFRobertaForSequenceClassification

tokenizer = RobertaTokenizer.from_pretrained('roberta-base')
model = TFRobertaForSequenceClassification.from_pretrained('roberta-base')

model.compile('adam', loss='sparse_categorical_crossentropy')
model.fit(x, y)

So where should I specify number of target labels for sequence classification?

1 Answers
Related