What is Transformers?
Transformers is Hugging Face's open-source model-definition framework. It provides a common API for thousands of pretrained machine learning models covering text, vision, audio, video and multimodal tasks, for both inference and training. Because model definitions in Transformers are treated as the reference by much of the ecosystem, other tools such as inference engines and fine-tuning libraries build on top of it. The library integrates tightly with the Hugging Face Hub, where you can download and share model weights.
Key features
- Pipelines: a one-line
pipeline()API for tasks like text generation, classification, speech recognition and image segmentation. - Huge model coverage: architectures for LLMs, vision transformers, speech models and vision-language models.
- Hub integration: load any compatible checkpoint with
from_pretrained()and push your own. - Trainer API: high-level training and fine-tuning loops with mixed precision and distributed support.
- Ecosystem compatibility: works with training frameworks such as Axolotl, Unsloth, DeepSpeed and FSDP, and inference engines such as vLLM, SGLang and TGI.
- Quantization support: load models in reduced precision to run on smaller hardware.
- Apache 2.0 license: free for commercial use.
Who is it for?
Transformers is for ML engineers, data scientists, researchers and application developers who want to run or adapt open models in Python. It is equally useful for quick experiments in a notebook and for production fine-tuning workflows.
Use cases
- Running open LLMs locally for chat or text generation
- Fine-tuning a model on domain-specific data
- Speech-to-text, image classification and object detection
- Building embeddings for search and retrieval
- Prototyping multimodal applications
Pricing
Transformers is free and open source under the Apache 2.0 license. Costs only come from the compute you run it on, or from optional paid Hugging Face services such as hosted inference endpoints.
What's new and trending
Transformers v5 brought a major refresh of the library. The latest release at the time of writing is v5.20.2, published October 19, 2026 (release notes). Releases regularly add support for newly published open models soon after launch.
Getting started
- Install PyTorch (2.6+), then
pip install transformers, using Python 3.11 or newer. - Try a pipeline:
from transformers import pipeline; pipe = pipeline("text-generation", model="<model-id>"). - Browse models on the Hugging Face Hub.
- Use
AutoTokenizerandAutoModelFor...classes for more control. - Read the official documentation for training and fine-tuning guides.
Alternatives
To run models locally without writing Python, look at Ollama, LM Studio, Jan and GPT4All. For hosted inference of open models, compare Replicate, Baseten, Modal and RunPod. To call many model APIs through one interface, see LiteLLM and OpenRouter.
FAQ
Is Hugging Face Transformers free? Yes. It is open source under the Apache 2.0 license and free for commercial use.
Does Transformers require a GPU? No, many models run on CPU, but a GPU greatly speeds up larger models and training.
What do I need to run Transformers? The current version needs Python 3.11 or newer and PyTorch 2.6 or newer.
What is the difference between Transformers and the Hugging Face Hub? The Hub hosts models and datasets; Transformers is the Python library that loads and runs those models.
Can I fine-tune LLMs with Transformers? Yes, using the Trainer API or companion libraries such as PEFT and TRL.

