Probable bug with `torch_dtype="auto"`
### System Info

```shell
- `transformers` version: 4.20.0.dev0
- Platform: Linux-5.17.8-arch1-1-x86_64-with-glibc2.35
- Python version: 3.9.10
- Huggingface_hub version: 0.4.0
- PyTorch version (GPU?): 1.10.2+cu113 (True)
- Tensorflow version (GPU?): 2.8.0 (False)
- Flax version (CPU?/GPU?/TPU?): 0.4.0 (cpu)
- Jax version: 0.3.1
- JaxLib version: 0.3.0
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No
```


### Who can help?

@LysandreJik 

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction


Reproducing script:

```python
from transformers import AutoModel


model = AutoModel.from_pretrained("Jeevesh8/lecun_feather_berts-96", torch_dtype="auto")
```

This seems to be a bug since the model does not load with error:
```
ValueError: Can't instantiate BertModel model under dtype=torch.int64 since it is not a floating point dtype
```


And the `config.json` actually defines a different `torch_dtype`.
https://huggingface.co/Jeevesh8/lecun_feather_berts-96
https://huggingface.co/Jeevesh8/lecun_feather_berts-96/blob/main/config.json#L29

### Expected behavior


I would expect the model to load regardless, or at the very least not crash while attempting to load with `torch.int64`.


cc @stas00 @sgugger <|||||>`torch_dtype="auto"` does not look at the config, but looks at the first parameter (which is also what the config saves automatically FYI). In both cases we should probably ignore the first parameter if it has an int dtype and loop until we get to a float or to the end (for quantized models which have an int dtype everywhere).<|||||>This looks like a wrong assumption on my part. 

@sgugger, would you like me to work on the fix if you haven't done this already?<|||||>I haven't started working on it, wanted to make sure my suggested solution seemed good to you. If you want to go ahead and implement it, by all means! Otherwise I'll do it sometime later today :-)<|||||>I will work on it. Will diagnose this model and see if we have a tiny model that has a similar arrangement to test with.