I am very new to using transformers. I have just started using them, and I require them for a classification task, Where I have tweets from topics, and I need to find their hate score. I have been suggested to use the GroNLP/hateBERT · Hugging Face model to do so.
But, I was trying it out by the following code:
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("GroNLP/hateBERT")
model = AutoModelForMaskedLM.from_pretrained("GroNLP/hateBERT")
Then I used the following code:
from transformers import pipeline
classifier = pipeline('text-classification', model=model, tokenizer=tokenizer)
But I am getting an error:
The model 'TFBertLMHeadModel' is not supported for text-classification. Supported models are ['TFAlbertForSequenceClassification', 'TFBertForSequenceClassification', 'TFCamembertForSequenceClassification', 'TFConvBertForSequenceClassification', 'TFCTRLForSequenceClassification', 'TFDebertaForSequenceClassification', 'TFDebertaV2ForSequenceClassification', 'TFDistilBertForSequenceClassification', 'TFElectraForSequenceClassification', 'TFFlaubertForSequenceClassification', 'TFFunnelForSequenceClassification', 'TFGPT2ForSequenceClassification', 'TFGPTJForSequenceClassification', 'TFLayoutLMForSequenceClassification', 'TFLayoutLMv3ForSequenceClassification', 'TFLongformerForSequenceClassification', 'TFMobileBertForSequenceClassification', 'TFMPNetForSequenceClassification', 'TFOpenAIGPTForSequenceClassification', 'TFRemBertForSequenceClassification', 'TFRobertaForSequenceClassification', 'TFRoFormerForSequenceClassification', 'TFTapasForSequenceClassification', 'TFTransfoXLForSequenceClassification', 'TFXLMForSequenceClassification', 'TFXLMRobertaForSequenceClassification', 'TFXLNetForSequenceClassification'].
Can someone suggest how to modify this code so I can use the hateBERT model to find the hateful score? And any resources to learn about using any generic models would be very helpful.