Automodel "from_config" fails when config is loaded from PretrainedConfig.from_dict(config)
### System Info

If the config is saved to dict, it cannot be converted back to autoconfig ??



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


```python
 bart_config = transformers.BartConfig(vocab_size=vocab_size, d_model=64,   encoder_ffn_dim=64, encoder_layers=2, decoder_ffn_dim=64, decoder_layers=2 )

config = bart_config.to_dict()

AutoModelForSeq2SeqLM.from_config(transformers.PretrainedConfig.from_dict(config))
```

This ends up in the following error. What is the alternative to loading autoconfig from a dict?
```text
ValueError: Unrecognized configuration class <class 'transformers.configuration_utils.PretrainedConfig'> for this kind of AutoModel: AutoModelForSeq2SeqLM.
Model type should be one of BartConfig, BigBirdPegasusConfig, BlenderbotConfig, BlenderbotSmallConfig, EncoderDecoderConfig, FSMTConfig, LEDConfig, LongT5Config, M2M100Config, MarianConfig, MBartConfig, MT5Config, PegasusConfig, PLBartConfig, ProphetNetConfig, T5Config, XLMProphetNetConfig.

```

### Expected behavior

`transformers.PretrainedConfig.from_dict(config)` should return the correct config type
Hi @elangovana 👋 `PretrainedConfig` is a base class, which is not supposed to work on its own.

Since you know what class you are storing in the example, you can simply do
```python
from transformers import AutoModelForSeq2SeqLM, BartConfig

vocab_size = 128

bart_config = BartConfig(
    vocab_size=vocab_size, d_model=64, encoder_ffn_dim=64, encoder_layers=2, decoder_ffn_dim=64, decoder_layers=2
)
config = bart_config.to_dict()
model = AutoModelForSeq2SeqLM.from_config(BartConfig.from_dict(config))
```

Alternatively, if you don't want to rely on a specific config class at load time, you can also do
```python
from transformers import AutoConfig, AutoModelForSeq2SeqLM, BartConfig

vocab_size = 128

bart_config = BartConfig(
    vocab_size=vocab_size, d_model=64, encoder_ffn_dim=64, encoder_layers=2, decoder_ffn_dim=64, decoder_layers=2
)
bart_config.save_pretrained("/tmp/")
model = AutoModelForSeq2SeqLM.from_config(AutoConfig.from_pretrained("/tmp"))
```<|||||>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.