From the Yelp Review dataset card, you know there are five labels: from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5) You will see a warning about some of the pretrained weights not being used and some weights being randomly initialized.