Error loading pretrained bert-base-multilingual-cased
# 🐛 Bug

## Information

Loading `bert-base-multilingual-cased` from pretrained gives an error:

```
Traceback (most recent call last):
  File "error.py", line 4, in <module>
    bert_model = transformers.AutoModel.from_pretrained('bert-base-multilingual-cased', config=config)
  File "/scratch/gobi1/bai/bai-conda/lib/python3.7/site-packages/transformers/modeling_auto.py", line 380, in from_pretrained
    return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
  File "/scratch/gobi1/bai/bai-conda/lib/python3.7/site-packages/transformers/modeling_utils.py", line 558, in from_pretrained
    model.__class__.__name__, "\n\t".join(error_msgs)
RuntimeError: Error(s) in loading state_dict for BertModel:
        size mismatch for bert.embeddings.word_embeddings.weight: copying a param with shape torch.Size([119547, 768]) from checkpoint, the shape in current model is torch.Size([30522, 768]).
```

## To reproduce

The following snippet produces the error:

```
import transformers

config = transformers.BertConfig(output_hidden_states=True)
bert_model = transformers.AutoModel.from_pretrained('bert-base-multilingual-cased', config=config)
print(bert_model)
```

## Expected behavior

The model should load. Note that `bert-base-uncased` is able to load properly.

## Environment info
     
- `transformers` version: 2.5.1
- Platform: Linux
- Python version: 3.7.5
- PyTorch version (GPU?): 1.4.0 with GPU
- Tensorflow version (GPU?): N/A
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

You're creating a configuration based on the size of `bert-base-uncased`, so yes, it will work for that checkpoint. For any other checkpoint, however, you would need to change the values which are different (e.g. vocab size, which is what's failing in your case). It is indicated in the [documentation](https://huggingface.co/transformers/model_doc/bert.html#bertconfig):

> This is the configuration class to store the configuration of a BertModel. It is used to instantiate an BERT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the BERT bert-base-uncased architecture.

In order to load a configuration automatically from a checkpoint, you may use `from_pretrained` on the configuration as well. In your case, that would be:

```py
import transformers

config = transformers.BertConfig.from_pretrained("bert-base-multilingual-cased", output_hidden_states=True)
bert_model = transformers.AutoModel.from_pretrained('bert-base-multilingual-cased', config=config)
print(bert_model)
```