HF Transformers iconHF Transformers

Hugging Face's model-definition library for 400+ text, vision, audio and multimodal architectures; PyTorch-only since v5

168k+ GitHub Stars
3M+ Daily pip Installs (Dec 2025)
v5.22.2 Latest Release (Nov 2026)

Overview

Transformers "acts as the model-definition framework for state-of-the-art machine learning models in text, computer vision, audio, video, and multimodal models, for both inference and training." It gives one consistent way to load and run models from the Hugging Face Hub (the docs cite over one million checkpoints) through the Pipeline API, the Trainer and generate(). Version 5, announced December 1, 2025 and released as v5.0.0 in January 2026, was its first major release in five years: PyTorch became the sole backend ("sunsetting our Flax/TensorFlow support"), tokenizers were unified, quantization moved to quantization_config, and transformers serve added continuous batching and paged attention. Supported architectures grew from 40 in v4 to over 400. Transformers is meant to be the shared model definition that other tools build on: the docs name Axolotl, Unsloth, DeepSpeed, FSDP and PyTorch Lightning for training and vLLM, SGLang, TGI, llama.cpp and MLX for inference. Apache-2.0. Also from Hugging Face: the Hugging Face Hub, TRL, LeRobot and Argilla.

The Verdict

Who Should Use Transformers?

Best For

  • Anyone loading, fine-tuning or testing open models from the Hub
  • Teams that want one API across text, vision, audio and multimodal models
  • Tool builders who need a reference model definition (fine-tuners, inference engines)

Not Ideal For

  • TensorFlow or Flax users (support was removed in v5)
  • High-throughput production serving, where the docs point to vLLM, SGLang or TGI
  • Projects that cannot keep up with weekly minor releases

What's Great

  • Over 400 architectures and over a million Hub checkpoints behind one API
  • New models land fast (v5.22.0 added Mistral Large 4 in October 2026)
  • Wide ecosystem support in training and inference tools
  • v5 simplified tokenizers, weight loading and quantization

Watch Out For

  • v5 is a breaking upgrade: TF and Flax classes, TorchScript and torch.fx dropped; load_in_4bit and load_in_8bit replaced
  • Weekly minor releases mean you should pin versions
  • The old transformers-cli was replaced by a new transformers command

Pricing

View all features & details

Key Features

  • Pipeline API: text generation, image segmentation, speech recognition, document QA and more
  • Trainer: mixed precision, torch.compile, FlashAttention, distributed training
  • generate(): LLM and VLM decoding strategies and streaming
  • transformers serve with continuous batching and paged attention (v5)
  • Default dtype auto; quantization through quantization_config

Integrations Named in the Docs

  • Training: Axolotl, Unsloth, DeepSpeed, FSDP, PyTorch Lightning
  • Inference: vLLM, SGLang, TGI
  • Adjacent: llama.cpp, MLX

Real-World Usage

Adoption

  • Over 3 million daily pip installs, up from 20,000 a day in v4 times
  • Over 1.2 billion cumulative installs
  • 750,000+ Hub checkpoints compatible with the library

Built On It

How It Compares

Feature Transformers PyTorch Keras 3 JAX
Role Pretrained model definitions Core framework Multi-backend high-level API Low-level array transforms
Backend PyTorch only (v5) Itself JAX, TensorFlow, PyTorch, OpenVINO Itself (XLA)
Model source Hugging Face Hub Your own or ecosystem KerasHub on Kaggle Flax ecosystem
License Apache-2.0 BSD-style Apache-2.0 Apache-2.0

Sources: GitHub · v5 blog · Keras 3

Is this your tool? Add a badge