are you fine-tuning it?
I am also new to transformers but last two days I have been struggling with this error,
the issue was the my labels were [0,2] whereas the model was taking it as [0-1], so that was the error, once I resolved the label classes to [0,1] it worked.