Open source · ★ 167,694 GitHub stars (as of 2026-10-14)
transformers
Transformers is a Hugging Face library for inference and training of text, image and speech models.
Overview
Transformers is Hugging Face's open-source library for defining text, computer vision, audio, video and multimodal models and using them for inference and training. Its goal is to centralize model definitions so that the models it supports are also compatible across many training frameworks and inference engines.
Every model is implemented with three classes: configuration, model and preprocessor. It provides Pipeline for simple inference across many tasks, Trainer with support for mixed precision, torch.compile, FlashAttention and distributed training, and generate with support for streaming and multiple decoding strategies.
It suits developers, machine learning engineers and researchers who want to load pretrained models from the Hugging Face Hub and use them directly or fine-tune them.
What it is used for
- Run text generation, image segmentation, speech recognition and document question answering with Pipeline.
- Load a pretrained model from the Hub and fine-tune it on your own data.
- Train models with Trainer using mixed precision and distributed training.
- Generate streaming text with LLMs and VLMs.
Pricing and license
Apache-2.0
Getting started
- Install the Transformers library in a Python environment.
- Find the model you want on the Hugging Face Hub.
- Load the model with Pipeline and run inference.
- If needed, fine-tune with Trainer.
Links
Related terms and companies
Recent mentions in briefings
Sources
Compiled from public sources (official pages, READMEs). Pricing and features change, so check the official site.