[NER] Fine-tune with custom dataset - Index Error: Target out of bounds

You have to change your labels to numbers starting from 0. I faced the same issue because I labeled my classes starting from 1 all the way to 4 (I had 4 classes). I encountered the same error mentioning Target 4 is out of bounds. When I changed my labels to 0,1,2,3, the issue vanished. check BertForSequenceClassification Index Error for more details.