"Size mismatch" when using the same type of model as pretraining during finetuning while "num_labels" is diffierent
Model - Roberta
The details of this issue are as follows:
Code used:
```
         pretrain model and param: RobertaForSequenceClassification with num_labels=3
         pretrain model saving method: model.save_pretrained(save_path)

         finetune model and param: RobertaForSequenceClassification with num_labels=2
         finetune load model param method: RobertaForSequenceClassification.from_pretrained(save_path, num_labels=2)
```

What I wished is to load pretrain param with the classifier layer param randomly initialized, for the finetune process has diffierent num_labels as pretrain. But I got the following error:
`RuntimeError: Error(s) in loading state_dict for RobertaForSequenceClassification:
	size mismatch for classifier.out_proj.weight: copying a param with shape torch.Size([3, 768]) from checkpoint, the shape in current model is torch.Size([2, 768]).
	size mismatch for classifier.out_proj.bias: copying a param with shape torch.Size([3]) from checkpoint, the shape in current model is torch.Size([2]).`

For sure, I can fix this manually by first loading the model params in RobertaModel, then saving RobertaModel and finally using RobertaModel params to init my new RobertaForSequenceClassification, but it's somehow complicated for the same kind of problems might occure at any moment. Maybe fix this in the next version of huggingface transformers in a good choice.

Best wish
@LysandreJik 


We've recently added a new `ignore_mismatched_sizes` argument to the `from_pretrained` method, which can be set to `True` to ignore such runtime errors, and to be able to replace the head of an already fine-tuned model.

You can run it as follows:

```
from transformers import RobertaForSequenceClassification

model = RobertaForSequenceClassification.from_pretrained("path_to_already_finetuned_model", num_labels= 3, ignore_mismatched_sizes=True)
```<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.