The model is giving me negative values!

#3
by IlDatori9512 - opened

Hi all,

I was running the politicalBiasBERT model on some short text files. The code runs properly till the end, but the outcome dive me e negative values, here the example I ran:

text = "I like you. I love you"

inputs = tokenizer(text, return_tensors="pt")

labels = torch.tensor([0])
outputs = model(**inputs, labels=labels)
loss, logits = outputs[:2]

logits
Out[21]: tensor([[-0.5009, -0.9261, -0.0304]], grad_fn=)

I have the same negative results even if I use: labels = torch.tensor([1])

Could someone suggest something for solving the issue? Thank you!

Bucket Research org
edited Jul 7, 2023

apply softmax:

logits.softmax(dim=-1)[0].tolist()

thanks for mentioning this, I have updated the readme with the changes aswell!

Sign up or log in to comment