# Transformers

CreateWithAI Hub page: https://createwithaihub.com/open-source/hugging-face-transformers
Latest version of this file: https://createwithaihub.com/open-source/hugging-face-transformers.md

- Type: Library · Category: Libraries & Open Source
- Publisher: Hugging Face
- Pricing: Free · License: Apache-2.0
- Runs on: macOS, Windows, Linux

Hugging Face's Python library of pretrained model definitions for text, vision, audio and multimodal inference and training.

Transformers is Hugging Face's model-definition framework for state-of-the-art models in text, vision, audio, video and multimodal tasks, used for both inference and training with PyTorch. Its model definitions are shared across the ecosystem, so supported models also work with many training frameworks and inference engines. It gives access to a very large number of pretrained checkpoints on the Hugging Face Hub.

Useful for: Loading and running a pretrained model in a few lines of Python, fine-tuning a model on your own data, or prototyping before moving to a dedicated inference engine.

## Key features

- Pipeline API for inference across many tasks
- Trainer with mixed precision, torch.compile, FlashAttention and distributed training
- generate() for LLM and VLM text generation with streaming
- Large catalog of pretrained checkpoints on the Hugging Face Hub
- Model definitions compatible with vLLM, SGLang, llama.cpp, MLX and others

## Connection

- Language: Python
- Focus: Inference / serving, Training & fine-tuning

## Before you start

- Python 3.11+
- PyTorch 2.6+

## Install steps from the official documentation

pip:

```
pip install "transformers[torch]"
```

uv:

```
uv pip install "transformers[torch]"
```

## Limitations

- Not designed as a modular toolbox of neural-network building blocks
- Trainer is optimized for Transformers' PyTorch models, not generic training loops

## Official links

- Website: https://huggingface.co/docs/transformers/index
- Source repository: https://github.com/huggingface/transformers
- Documentation: https://huggingface.co/docs/transformers/index
- Source: https://github.com/huggingface/transformers (Install commands, Python/PyTorch requirements, when not to use; Apache-2.0; not archived)
- Source: https://huggingface.co/docs/transformers/index (Framework description and main features)
- Source: https://huggingface.co/docs/transformers/installation (Install options; Windows cache path documented)
