Hugging Face Transformers
An open-source Python library serving as the model-definition framework for state-of-the-art machine learning models across text, vision, audio, video, and multimodal tasks.
At a Glance
About Hugging Face Transformers
Hugging Face Transformers is the canonical open-source library for working with state-of-the-art pretrained machine learning models. Released under the Apache 2.0 license and maintained by Hugging Face, it acts as the central model-definition framework that the broader ML ecosystem—training frameworks, inference engines, and adjacent libraries—relies on. The project is hosted on GitHub and has accumulated over 166,000 stars, reflecting its role as a foundational tool in modern machine learning.
What It Is
Transformers is a Python library that centralizes model definitions for text, computer vision, audio, video, and multimodal deep learning. Its core design principle is that a model defined in Transformers becomes compatible with the majority of training frameworks (Axolotl, Unsloth, DeepSpeed, FSDP, PyTorch-Lightning) and inference engines (vLLM, SGLang, TGI), as well as adjacent modeling libraries like llama.cpp and mlx. The library provides over 1 million pretrained model checkpoints on the Hugging Face Hub, covering architectures from BERT and T5 to Llama, Qwen, Gemma, and Whisper.
Core Architecture and Design
Every model in Transformers is implemented from three main classes: configuration, model, and preprocessor. This deliberate simplicity keeps model internals transparent and easy to iterate on without additional abstraction layers. The library exposes three primary high-level APIs:
- Pipeline: A high-level inference class supporting text generation, image segmentation, automatic speech recognition, document question answering, and more.
- Trainer: A comprehensive training class with support for mixed precision,
torch.compile, FlashAttention, and distributed training for PyTorch models. - generate: Fast text generation for large language models (LLMs) and vision language models (VLMs), with streaming and multiple decoding strategies.
The library works with Python 3.10+ and PyTorch 2.5+, and supports installation via pip or uv.
Supported Modalities and Tasks
Transformers covers a wide range of tasks across modalities:
- NLP: Text generation, summarization, translation, named entity recognition, question answering, masked word completion
- Computer Vision: Image classification, object detection, depth estimation, segmentation, pose estimation, video classification
- Audio: Automatic speech recognition, audio classification, text-to-speech, text-to-audio, speech-to-speech
- Multimodal: Visual question answering, image captioning, document understanding, OCR, table question answering
Example models supported include Whisper, Llama, Qwen, BART, T5, SAM, BLIP-2, LayoutLMv3, and many others.
Ecosystem Integration
Transformers acts as the pivot point across the ML ecosystem. Because model definitions are centralized here, downstream tools can rely on a single, agreed-upon implementation. Training frameworks like Axolotl and Unsloth consume Transformers model definitions directly. Inference engines like vLLM and SGLang do the same. This means a model added to Transformers becomes immediately accessible to a large portion of the open-source ML toolchain without additional porting work.
Update: Release v5.17.0
The latest stable release is v5.17.0, published on September 9, 2026, with active development continuing on the main branch. The version history spans from v1.0.0 through the current v5.x series, reflecting years of continuous development. The documentation version selector lists dozens of releases, and the GitHub repository shows recent pushes as of September 2026. The project also supports a transformers serve command and a transformers chat CLI for interacting with models directly from the terminal, indicating ongoing expansion beyond the Python API into developer tooling.
Community Discussions
Be the first to start a conversation about Hugging Face Transformers
Share your experience with Hugging Face Transformers, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully free and open-source under Apache 2.0 license. Install via pip and use any of 1M+ pretrained model checkpoints.
- Apache 2.0 license
- 1M+ pretrained model checkpoints
- Pipeline, Trainer, and generate APIs
- Multi-framework support (PyTorch, JAX, TF)
- CLI tools
Capabilities
Key Features
- Pipeline API for high-level inference across text, audio, vision, and multimodal tasks
- Trainer class with mixed precision, torch.compile, FlashAttention, and distributed training
- Fast text generation with LLMs and VLMs via generate API
- 1M+ pretrained model checkpoints on Hugging Face Hub
- Support for PyTorch, JAX, and TensorFlow frameworks
- Automatic speech recognition, image classification, object detection, and more
- Multimodal model support including vision-language models
- CLI tools: transformers serve and transformers chat
- Parameter-efficient fine-tuning (PEFT) integration
- Compatible with vLLM, SGLang, TGI, Axolotl, Unsloth, DeepSpeed, FSDP
- Model files usable independently of the library
- Streaming and multiple decoding strategies for text generation
