RuntimeError: Error(s) in loading state_dict for RobertaForSequenceClassification

#3
by liuyao307 - opened

As a beginner, I have encountered some issues while using your model. When using AutoModelForSequenceClassific.from_pretrained, or even RobertaForSequenceClassific.from_pretrained, I encountered an error as shown in the following :
RuntimeError: Error (s) in loading state_dict for RobertaForSequenceClassification:
Size mismatch for classifier. out proj. weight: copying a param with shape torch Size ([16, 768]) from checkpoint, the shape in current model is torch Size ([36, 768])
Size mismatch for classifier. out proj. bias: copying a param with shape torch Size ([16]) from checkpoint, the shape in current model is torch Size ([36])
You may consider adding ignore_mismatched_sizes=True in the model free_pretrained method.
How can I resolve this issue? thanks

Sign up or log in to comment