> For the complete documentation index, see [llms.txt](https://boinc-ai.gitbook.io/transformers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boinc-ai.gitbook.io/transformers/api/main-classes/auto-classes.md).

# Auto Classes

In many cases, the architecture you want to use can be guessed from the name or the path of the pretrained model you are supplying to the `from_pretrained()` method. AutoClasses are here to do this job for you so that you automatically retrieve the relevant model given the name/path to the pretrained weights/config/vocabulary.

Instantiating one of [AutoConfig](https://huggingface.co/docs/transformers/v4.34.1/en/model_doc/auto#transformers.AutoConfig), [AutoModel](https://huggingface.co/docs/transformers/v4.34.1/en/model_doc/auto#transformers.AutoModel), and [AutoTokenizer](https://huggingface.co/docs/transformers/v4.34.1/en/model_doc/auto#transformers.AutoTokenizer) will directly create a class of the relevant architecture. For instance

Copied

```
model = AutoModel.from_pretrained("bert-base-cased")
```

will create a model that is an instance of [BertModel](https://huggingface.co/docs/transformers/v4.34.1/en/model_doc/bert#transformers.BertModel).

There is one class of `AutoModel` for each task, and for each backend (PyTorch, TensorFlow, or Flax).
