CPM_BEE model should have local model_path to infer and don't use  trust_remote_code=True
Author: fxrhhx
Pull request: no

### System Info

I want to use my local model path for infer openbmb/cpm-bee-10b, like
model_path="/home/users/fanxingran/workspace/workspace/cpm_bee_cpu/cpm-bee-10b"
tokenizer = AutoTokenizer.from_pretrained(model_path, cache_dir=model_path, subfolder="scheduler", trust_remote_code=False)
model = AutoModelForCausalLM.from_pretrained(model_path, cache_dir=model_path, trust_remote_code=False).cpu()  #
but it coulud't work , if I use 
# tokenizer = AutoTokenizer.from_pretrained("openbmb/cpm-bee-10b", trust_remote_code=True)
# model = AutoModelForCausalLM.from_pretrained("openbmb/cpm-bee-10b", trust_remote_code=True).cpu()
every time will down something in .cache/huggface

### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

from transformers import AutoModelForCausalLM, AutoTokenizer
model_path="/home/users/fanxingran/workspace/workspace/cpm_bee_cpu/cpm-bee-10b"
cache_dir=model_path
tokenizer = AutoTokenizer.from_pretrained(model_path, cache_dir=model_path, subfolder="scheduler", trust_remote_code=False)
model = AutoModelForCausalLM.from_pretrained(model_path, cache_dir=model_path, trust_remote_code=False).cpu()  # 

result = model.generate({"input": "今天天气不错，", "<ans>": ""}, tokenizer)
print(result)

### Expected behavior

i want to infer cpm-bee-10b in local model_path and  i could change the code (very import change code)
use the .cache will update the code and the change is will be delete with the update 

Comments:
Hi @fxrhhx, 

`cache_dir` is the [directory where the checkpoint is located](https://huggingface.co/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoModel.from_pretrained.cache_dir).

`pretrained_model_name_or_path` is either [the checkpoint name, or the full path to the directory containing weights & configs](https://huggingface.co/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoModel.from_pretrained.pretrained_model_name_or_path).

In this case, following your example, this should work: 

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
cache_dir="/home/users/fanxingran/workspace/workspace/cpm_bee_cpu"
checkpoint = "cpm-bee-10b"
model = AutoModelForCausalLM.from_pretrained(checkpoint, cache_dir=cache_dir)

# Pass in the full model path
model_path = "/home/users/fanxingran/workspace/workspace/cpm_bee_cpu/cpm-bee-10b"
model = AutoModelForCausalLM.from_pretrained(model_path)
```


> Thank you for your answer!! I found use the code like this, is also dont't work, will still download something is .cache/huggface and use it, the model_path which i give containing the weights and configs, i couldn't understant why
> 
`from transformers import AutoModelForCausalLM, AutoTokenizer`
`model_path="/home/users/fanxingran/workspace/workspace/cpm_bee_cpu/cpm-bee-10b"`
`tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)`
`model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True).cpu() `
`result = model.generate({"input": "今天天气不错，", "<ans>": ""}, tokenizer)`
`print(result)`




![9f353864f24ba9a6688e9ba99280747e](https://github.com/huggingface/transformers/assets/42543089/97396528-6f7b-4739-99ec-82f45a6176fc)



![01b809b730e290bb1b536122829191c5](https://github.com/huggingface/transformers/assets/42543089/646f00c9-1a69-401c-92f4-e85799ff3fb8)


@fxrhhx Without knowing what's in the model path, it won't be possible to debug this. Could you run:

```
ls /home/users/fanxingran/workspace/workspace/cpm_bee_cpu/cpm-bee-10b
```

And
```
less /home/users/fanxingran/workspace/workspace/cpm_bee_cpu/cpm-bee-10b/config.json
```
?

Just from this, it looks like the modeling config is pointing to the model on the hub: https://huggingface.co/openbmb/cpm-bee-10b/blob/4b1905b3195203330c462ed367d97c3361288937/config.json#L3


> @fxrhhx Without knowing what's in the model path, it won't be possible to debug this. Could you run:
> 
> ```
> ls /home/users/fanxingran/workspace/workspace/cpm_bee_cpu/cpm-bee-10b
> ```
> 
> And
> 
> ```
> less /home/users/fanxingran/workspace/workspace/cpm_bee_cpu/cpm-bee-10b/config.json
> ```
> 
> ?
> 
> Just from this, it looks like the modeling config is pointing to the model on the hub: https://huggingface.co/openbmb/cpm-bee-10b/blob/4b1905b3195203330c462ed367d97c3361288937/config.json#L3

![63e85e8609d966a4ac2704b71c79f710](https://github.com/huggingface/transformers/assets/42543089/eeef3212-6b4c-4c5d-854c-cc82c374c4f2)
![3c53e82442b8b7aa8b2139c5b9ba9156](https://github.com/huggingface/transformers/assets/42543089/ffecd4aa-f344-4f44-a71a-cd9a471a4bb3)


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.