Dutch sentiment analysis RobBERTje outputs just positive/negative labels, netural label is missing

#2
by happilylazy - opened

When I run Dutch sentiment analysis RobBERTje, it outputs just positive/negative labels, netural label is missing in the data.

https://huggingface.co/DTAI-KULeuven/robbert-v2-dutch-sentiment

There are obvious neutral sentences/words e.g. 'Fhdf' (nonsense) and 'Als gisteren inclusief blauw' (neutral), but they both evaluate to positive or negative.

Is there a way to get neutral labels for such examples in RobBERTje?

from transformers import RobertaTokenizer, RobertaForSequenceClassification
from transformers import pipeline
import torch

model_name = "DTAI-KULeuven/robbert-v2-dutch-sentiment"
model = RobertaForSequenceClassification.from_pretrained(model_name)
tokenizer = RobertaTokenizer.from_pretrained(model_name)

classifier = pipeline('sentiment-analysis', model=model, tokenizer = tokenizer)

result1 = classifier('Fhdf')
result2 = classifier('Als gisteren inclusief blauw')
print(result1)
print(result2)

Output:

[{'label': 'Positive', 'score': 0.7520257234573364}]
[{'label': 'Negative', 'score': 0.7538396120071411}]

Sign up or log in to comment