GOT_OCR does not work with the AutoModel.from_pretrained
Author: saucam
Pull request: no
Labels: name: bug

### System Info

The standard way to load model is broken for GOT_OCR_2 model, and the following error is thrown

```
KeyError                                  Traceback (most recent call last)
File [~/anaconda3/envs/mbert/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py:1071](http://localhost:8889/home/ydatta/anaconda3/envs/mbert/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py#line=1070), in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
   1070 try:
-> 1071     config_class = CONFIG_MAPPING[config_dict["model_type"]]
   1072 except KeyError:

File [~/anaconda3/envs/mbert/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py:773](http://localhost:8889/home/ydatta/anaconda3/envs/mbert/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py#line=772), in _LazyConfigMapping.__getitem__(self, key)
    772 if key not in self._mapping:
--> 773     raise KeyError(key)
    774 value = self._mapping[key]

KeyError: 'got_ocr2'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
Cell In[2], line 4
      1 from transformers import AutoProcessor, AutoModel
      2 device = "cuda" if torch.cuda.is_available() else "cpu"
----> 4 model = AutoModel.from_pretrained("stepfun-ai[/GOT-OCR-2.0-hf](http://localhost:8889/GOT-OCR-2.0-hf)", device_map=device)
      5 processor = AutoProcessor.from_pretrained("stepfun-ai[/GOT-OCR-2.0-hf](http://localhost:8889/GOT-OCR-2.0-hf)")

File [~/anaconda3/envs/mbert/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py:526](http://localhost:8889/home/ydatta/anaconda3/envs/mbert/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py#line=525), in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    523 if kwargs.get("quantization_config", None) is not None:
    524     _ = kwargs.pop("quantization_config")
--> 526 config, kwargs = AutoConfig.from_pretrained(
    527     pretrained_model_name_or_path,
    528     return_unused_kwargs=True,
    529     trust_remote_code=trust_remote_code,
    530     code_revision=code_revision,
    531     _commit_hash=commit_hash,
    532     **hub_kwargs,
    533     **kwargs,
    534 )
    536 # if torch_dtype=auto was passed here, ensure to pass it on
    537 if kwargs_orig.get("torch_dtype", None) == "auto":

File [~/anaconda3/envs/mbert/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py:1073](http://localhost:8889/home/ydatta/anaconda3/envs/mbert/lib/python3.12/site-packages/transformers/models/auto/configuration_auto.py#line=1072), in AutoConfig.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
   1071         config_class = CONFIG_MAPPING[config_dict["model_type"]]
   1072     except KeyError:
-> 1073         raise ValueError(
   1074             f"The checkpoint you are trying to load has model type `{config_dict['model_type']}` "
   1075             "but Transformers does not recognize this architecture. This could be because of an "
   1076             "issue with the checkpoint, or because your version of Transformers is out of date.\n\n"
   1077             "You can update Transformers with the command `pip install --upgrade transformers`. If this "
   1078             "does not work, and the checkpoint is very new, then there may not be a release version "
   1079             "that supports this model yet. In this case, you can get the most up-to-date code by installing "
   1080             "Transformers from source with the command "
   1081             "`pip install git+https://github.com/huggingface/transformers.git`"
   1082         )
   1083     return config_class.from_dict(config_dict, **unused_kwargs)
   1084 else:
   1085     # Fallback: use pattern matching on the string.
   1086     # We go from longer names to shorter names to catch roberta before bert (for instance)

ValueError: The checkpoint you are trying to load has model type `got_ocr2` but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date.
```

### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction


```
from transformers import AutoProcessor, AutoModel
device = "cuda" if torch.cuda.is_available() else "cpu"

model = AutoModel.from_pretrained("stepfun-ai/GOT-OCR-2.0-hf", device_map=device)
processor = AutoProcessor.from_pretrained("stepfun-ai/GOT-OCR-2.0-hf")
```

### Expected behavior

Model is loaded correctly

Comments: