'Target 3 is out of bounds' error with Huggingface Trainer.train()

You have to change your class labels to [0,1,2]. Check BertForSequenceClassification Index Error for more details.