Num_labels creates an error for some models
Hello,I am training a classifier for three classes(bad, medium, good)usingdistilbert-base-uncased-finetuned-sst-2-englishbut after saving the model to disk and re-loading it I am getting a strange errorfrom transformers import AutoTokenizer, TFAutoModelForSequenceClassification
  
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
model = TFAutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")

tokenizer.save_pretrained('finetuned')
model.save_pretrained('finetuned')
model.from_pretrained('finetuned', num_labels = 3)

ValueError: cannot reshape array of size 1536 into shape (768,3)This approach worked withbert-base-uncased. Am I doing something wrong here?Thanks!
2021-08-03T16:08:33Z
With the latest version installed, you need to addignore_mismatched_sizes=Trueto yourfrom_pretrainedcall for this to work.Otherwise, you try to load a model with 2 labels inside a model with 3 labels, and you get mismatched sizes like that.
2021-08-03T16:12:29Z
thanks@sgugger, life saving tip!