Cannot load model saved with AutoModelForMaskedLM.from_pretrained if state_dict = True
Author: q-clint
Pull request: no

Hello,  

It seems that setting the `state_dict=True` flag in a model's `.save_pretrained` method breaks the load process for `AutoModelForMaskedLM.from_pretrained`

The following code works
```
from transformers import AutoModelForMaskedLM
model = AutoModelForMaskedLM.from_pretrained('distilroberta-base')
model.save_pretrained(
    save_directory = './deleteme',
    save_config = True,
    #state_dict = True,
    push_to_hub = False,
)
model = AutoModelForMaskedLM.from_pretrained('./deleteme')
```

However, the following code does not
```
from transformers import AutoModelForMaskedLM
model = AutoModelForMaskedLM.from_pretrained('distilroberta-base')
model.save_pretrained(
    save_directory = './deleteme',
    save_config = True,
    state_dict = True,
    push_to_hub = False,
)
model = AutoModelForMaskedLM.from_pretrained('./deleteme')
```
with error:
```
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-17-3ab36ee4e5d3> in <module>
      8     push_to_hub = False,
      9 )
---> 10 model = AutoModelForMaskedLM.from_pretrained('./deleteme')

~/anaconda3/envs/pytorch/lib/python3.8/site-packages/transformers/models/auto/auto_factory.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    393         if type(config) in cls._model_mapping.keys():
    394             model_class = _get_model_class(config, cls._model_mapping)
--> 395             return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
    396         raise ValueError(
    397             f"Unrecognized configuration class {config.__class__} for this kind of AutoModel: {cls.__name__}.\n"

~/anaconda3/envs/pytorch/lib/python3.8/site-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
   1217                     )
   1218 
-> 1219             model, missing_keys, unexpected_keys, error_msgs = cls._load_state_dict_into_model(
   1220                 model, state_dict, pretrained_model_name_or_path, _fast_init=_fast_init
   1221             )

~/anaconda3/envs/pytorch/lib/python3.8/site-packages/transformers/modeling_utils.py in _load_state_dict_into_model(cls, model, state_dict, pretrained_model_name_or_path, _fast_init)
   1243         old_keys = []
   1244         new_keys = []
-> 1245         for key in state_dict.keys():
   1246             new_key = None
   1247             if "gamma" in key:

AttributeError: 'bool' object has no attribute 'keys'
```
Environment:
```
>>> transformers.__version__
'4.8.2'
>>> torch.__version__
'1.8.0+cu111'
```

Fixes tried (but same error):
- tried with transformers 4.8.1
- tried with absolute paths (rather than relative) 
- tried also saving configuration with:  
```
from transformers import AutoConfig
config = AutoConfig.from_pretrained('distilroberta-base')
config.save_pretrained('./deleteme')
```

Comments:
Hello! You can find the documentation regarding `from_pretrained` here: https://huggingface.co/transformers/main_classes/model.html#transformers.PreTrainedModel.from_pretrained

Namely, regarding the state dict:
```
state_dict (Dict[str, torch.Tensor], optional) –
    A state dictionary to use instead of a state dictionary loaded from saved weights file.

    This option can be used if you want to create a model from a pretrained configuration but load your own weights. In this case 
    though, you should check if using save_pretrained() and from_pretrained() is not a simpler option.
```
It accepts a state dict, not a boolean.

What are you trying to do by passing it `state_dict=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.