Transformers
Open-source Python library defining state-of-the-art ML models for inference and training
- Tool type
- Python ML model library
- Made for
- Developers, ML engineers, researchers
- Runs on
- Local Python with PyTorch
- Tested on Python 3.11+ and PyTorch 2.6+; CUDA, CPU and Intel XPU install options
What it does
Transformers is a Python library from Hugging Face that defines machine learning models for text, computer vision, audio, video and multimodal tasks. You load a pretrained checkpoint from the Hugging Face Hub, which hosts over a million of them, and the library handles configuration, model code and preprocessing. Output depends on the task: generated text, sentiment labels, image segmentations, speech transcripts or document answers, or a fine-tuned model you trained yourself.
In practice, developers call the Pipeline class for quick inference, use generate for text generation with LLMs and vision language models, or use Trainer for PyTorch training with mixed precision, torch.compile, FlashAttention and distributed training. Its distinguishing role is as a shared model definition: the docs say supported models are compatible with most training frameworks, inference engines such as vLLM, SGLang and TGI, and libraries like llama.cpp and mlx.
It suits developers, machine learning engineers and researchers comfortable with Python. The docs state it has been tested on Python 3.11+ and PyTorch 2.6+, and it installs with uv, pip or conda. Models are downloaded from the Hub and cached locally, with an offline mode available. Limitations: it targets PyTorch, expects coding skills, and needs suitable hardware such as an NVIDIA GPU for heavier models. Installing from source may be less stable than releases.
What it can do
- Pipeline class for inference across tasks such as text generation, image segmentation, speech recognition and document question answering
- Trainer for PyTorch training with mixed precision, torch.compile, FlashAttention and distributed training
- Generate method for LLM and vision language model text generation with streaming and multiple decoding strategies
- Loads pretrained checkpoints from the Hugging Face Hub with local caching
- Offline mode for firewalled environments using pre-downloaded model files
Works with
- Axolotl
- Unsloth
- DeepSpeed
- FSDP
- PyTorch-Lightning
- vLLM
- SGLang
- TGI
- llama.cpp
- mlx
Example workflows
- Classify text with a pretrained model
- Input: a sentence. Steps: create a virtual environment, install transformers[torch], run a sentiment-analysis pipeline. Output: a label and score for the text.
- Prepare a model for offline use
- Input: a Hub repository ID. Steps: download it with snapshot_download, set HF_HUB_OFFLINE=1, load with from_pretrained. Output: a model loaded from the local cache without Hub calls.
Before you choose
- Documentation states support for PyTorch; other frameworks are not mentioned as supported
- Installing from source gives the latest changes but may be less stable than the released version
- Model downloads are cached locally (default ~/.cache/huggingface/hub), so plan disk space and cache location
Listed under
Get started
Follow the installation guide
- Create a virtual environment, for example with uv venv
- Install with uv pip install "transformers[torch]" or conda install conda-forge::transformers
- Run the sentiment-analysis pipeline one-liner to confirm the install works
Plans and prices
The source code is available under Apache 2.0. You supply compute; model licenses and optional hosting have their own terms.
- Apache 2.0 license
Source: github.com/huggingface/transformers, checked 28 Oct 2026. Prices can change; check before you buy.
Sources for this overview
Product pages, documentation, and pricing checked 28 Oct 2026. Each source supports part of the overview; availability and prices can change.
- Transformers · Hugging Face ↗huggingface.co
- Pricing - Hugging Face ↗huggingface.co
- Installation · Hugging Face ↗huggingface.co
- GitHub - huggingface/transformers: 🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training. · GitHub ↗github.com
Ratings and reviews
No ratings for Transformers yet.
What’s changed
Free accountSignals
Free accountData and security
Free accountCompare with similar tools
Free accountWhere this comes from
How we research- Company website
- huggingface.co: product, pricing and policy pages
- YC directory mirror
- Batch and company name
- Web search
- Confirms the official site
- Social accounts
- Accounts the company links, and its posts on X
- Human review
- Checked by a person
- knowledge_base
Last checked 28 Oct 2026. Every field keeps its source and date; unknown means we couldn’t confirm it.