is config argument necessary for XXModel.from_pretrained method? And when is needed?
# ❓ Questions & Help

I find the model can be loaded with `XXModel.from_pretrained` function even if no `config` argument is given. But if the `config` is given, the argument `gradient_checkpointing` cannot be enabled. I wonder why the config argument can lead to the unable of `gradient_checkpointing`??? 

I test the conclusion with longformer model. Thanks!

Hi @xixiaoyao 
The `config` argument is not required for `from_pretrained`, when `config` is not passed it loads the saved config from the model dir. However, it's necessary to pass `config`  when you wan't to override some config value, like setting `gradient_checkpointing` to `True`. Here's how you can override the `config`  and pass it to `from_pretrained`.

```python
config = XXConfig.from_pretrained(path, gradient_checkpointing=True)
model = XXModel.from_pretrained(path, config=config)
```<|||||>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
