Loading FlaxHybridCLIP trained model 
Author: vinid
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.9.0.dev0
- Platform: Linux-5.4.0-1043-gcp-x86_64-with-glibc2.29
- Python version: 3.8.10
- PyTorch version (GPU?): 1.9.0+cu102 (False)
- Tensorflow version (GPU?): 2.5.0 (False)
- Flax version (CPU?/GPU?/TPU?): 0.3.4 (tpu)
- Jax version: 0.2.16
- JaxLib version: 0.1.68
- Using GPU in script?: N/A
- Using distributed or parallel set-up in script?: N/A

Models:

- FlaxHybridCLIP

## Information

I am not sure about how to load a trained  FlaxHybridCLIP model from a folder. We trained using [this](https://github.com/huggingface/transformers/tree/master/examples/research_projects/jax-projects/hybrid_clip).

I tried:  `FlaxHybridCLIP.from_text_vision_pretrained(PATH_TRAINED_MODEL, PATH_TRAINED_MODEL)`, but I got the following error: 

```Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vinid/transformers/examples/research_projects/jax-projects/hybrid_clip/modeling_hybrid_clip.py", line 333, in from_text_vision_pretrained
    text_config = AutoConfig.from_pretrained(text_model_name_or_path)
  File "/home/raphaelp/transformers/src/transformers/models/auto/configuration_auto.py", line 452, in from_pretrained
    config_class = CONFIG_MAPPING[config_dict["model_type"]]
KeyError: 'hybrid-clip'
```

The folder (PATH_TRAINED_MODEL) contains the two following files:

- `config.json`
- `flax_model.msgpack`

Thank you :) :) 



Comments:
Sorry, totally forgot to tag you @patrickvonplaten, @patil-suraj :)

Thanks :) 

Hi @vinid 

To load the trained model or if you save the `FlaxHybridCLIP` model using the `save_pretrained` method, you could directly use the `FlaxHybridCLIP.from_pretrained` method. Let me know If that works.

Thanks for your reply! :)

I am getting a new error now, seems like it is looking for something in the configs

```
>>> FlaxHybridCLIP.from_pretrained(PATH_TRAINED_MODEL)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/giuseppe/transformers/src/transformers/modeling_flax_utils.py", line 265, in from_pretrained
    config, model_kwargs = cls.config_class.from_pretrained(
AttributeError: 'NoneType' object has no attribute 'from_pretrained'
```


Aah, I see. That's actually a bug, I will work on a fix.

As a workaround could you try loading the config and then pass it to the `from_pretrained` ?
```python
config = HybridCLIPConfig.from_pretrained("...")
model = FlaxHybridCLIP.from_pretrained("...", config=config)
```

I think this works. Or at least it doesn't throw an error:
```python
with open(path_to_config, 'r') as f:
    config_dict = json.load(f)
config_dict['vision_config']['model_type'] = 'clip'
config = HybridCLIPConfig(text_config_dict=config_dict['text_config'], vision_config_dict=config_dict['vision_config'])
model = FlaxHybridCLIP.from_pretrained(path_to_msgpack, config=config)
```

Fix is here #12519

This same issue is present for FlaxEncoderDecoderModel. Would it be possible for use the same fix?

Hi @timothybrooks 

Could you open a new issue for `FlaxEncoderDecoderModel` and post the stack trace and code to reproduce there? Thanks!