`AutoModelForCausalLM.from_config` doesn't handle `revision="79ec93c"` correctly
### System Info

To reproduce:

```
from transformers import AutoModelForCausalLM, AutoConfig
config = AutoConfig.from_pretrained("mosaicml/mpt-7b", trust_remote_code=True, revision="79ec93c")
config.n_layers = 0
config.d_model = 16
config.n_heads = 4
model = AutoModelForCausalLM.from_config(config, trust_remote_code=True, revision = "79ec93c")
```

and the error is:

```
In [21]: model = AutoModelForCausalLM.from_config(config, trust_remote_code=True, revision = "79ec93c")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[21], line 1                                                                                                                                        
----> 1 model = AutoModelForCausalLM.from_config(config, trust_remote_code=True, revision = "79ec93c")

File /opt/conda/envs/torch2.0.1/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:422, in _BaseAutoModelClass.from_config(cls, config, *
*kwargs)
    420     model_class = get_class_from_dynamic_module(class_ref, repo_id, **kwargs)
    421     _ = kwargs.pop("code_revision", None)
--> 422     return model_class._from_config(config, **kwargs)
    423 elif type(config) in cls._model_mapping.keys():
    424     model_class = _get_model_class(config, cls._model_mapping)

File /opt/conda/envs/torch2.0.1/lib/python3.10/site-packages/transformers/modeling_utils.py:1143, in PreTrainedModel._from_config(cls, config, **kwargs)
   1141         model = cls(config, **kwargs)
   1142 else:
-> 1143     model = cls(config, **kwargs)
   1145 # restore default dtype if it was modified
   1146 if dtype_orig is not None:

TypeError: MPTForCausalLM.__init__() got an unexpected keyword argument 'revision'
```

### Who can help?

Probably @sgugger 

### 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

Provided in the issue message

### Expected behavior

Loading the model not crashing
You should pass `code_revision` and not `revision` in your second call: you are loading the model code for that revision, not the weights.<|||||>Works. Thank you.