Errors when using "torch_dtype='auto" in "AutoModelForCausalLM.from_pretrained()" to load model 
### System Info

python 3.8.13;
torch 1.10.0+cu113;
transformers 4.20.1;


### Who can help?

@stas00,@sgugger,@patil-suraj, @patrickvonplaten, @LysandreJik

### Information

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

### Tasks

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

### Reproduction
`
import  torch

from transformers import (
    AutoModelForCausalLM,
    AutoConfig
)

from transformers.modeling_utils import PreTrainedModel

path = "./opt-6.7b-ori"

config = AutoConfig.from_pretrained('facebook/opt-6.7b')

model = AutoModelForCausalLM.from_pretrained('facebook/opt-6.7b',torch_dtype='auto',config=config,cache_dir='/ssdwork/cache/')

pretrainmodel = PreTrainedModel(config=config)

pretrainmodel.model = model

pretrainmodel.save_pretrained(save_directory=path, is_main_process=True , state_dict=None)
`

### BUG
`Traceback (most recent call last):
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/torch/serialization.py", line 308, in _check_seekable
    f.seek(f.tell())
AttributeError: 'list' object has no attribute 'seek'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/transformers/modeling_utils.py", line 461, in load_state_dict
    return torch.load(checkpoint_file, map_location="cpu")
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/torch/serialization.py", line 594, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/torch/serialization.py", line 235, in _open_file_like
    return _open_buffer_reader(name_or_buffer)
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/torch/serialization.py", line 220, in __init__
    _check_seekable(buffer)
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/torch/serialization.py", line 311, in _check_seekable
    raise_err_msg(["seek", "tell"], e)
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/torch/serialization.py", line 304, in raise_err_msg
    raise type(e)(msg)
AttributeError: 'list' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "re_generate_best_model_from_shard.py", line 114, in <module>
    model = AutoModelForCausalLM.from_pretrained(folder_name, torch_dtype='auto', cache_dir='/ssdwork/cache/')
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/transformers/models/auto/auto_factory.py", line 446, in from_pretrained
    return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/transformers/modeling_utils.py", line 2148, in from_pretrained
    one_state_dict = load_state_dict(resolved_archive_file)
  File "/ssdwork/miniconda3/envs/tk-instruct/lib/python3.8/site-packages/transformers/modeling_utils.py", line 464, in load_state_dict
    with open(checkpoint_file) as f:
TypeError: expected str, bytes or os.PathLike object, not list
`
<img width="702" alt="image" src="https://user-images.githubusercontent.com/83019888/198872310-03848039-fef4-47e4-826b-2d1224c38eca.png">


### Expected behavior

The original model weight's data type is fp16.  As we known, the process of loading models with 'from_pretrained()' will change the dtype from fp16 to fp32 as default, thus I add torch_dtype='auto' as official guideline, but it turn out to be a error. Howerve, if we use torch_dtype=torch.float16, we will get desired result.
I believe this has been fixed in more recent versions of Transformers (can't be entirely sure since your code sample and traceback are not properly formatted between three backticks, so very hard to read).
Could you try to upgrade to the latest version?<|||||>> I believe this has been fixed in more recent versions of Transformers (can't be entirely sure since your code sample and traceback are not properly formatted between three backticks, so very hard to read). Could you try to upgrade to the latest version?

alright, I will try to upgeade the version of Transformers.<|||||>> I believe this has been fixed in more recent versions of Transformers (can't be entirely sure since your code sample and traceback are not properly formatted between three backticks, so very hard to read). Could you try to upgrade to the latest version?

Hello, I've updated the verson of transformer, and there is still the bug. I've update the comment with a screen shot of bug for read.<|||||>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/main/CONTRIBUTING.md) are likely to be ignored.