Transformers
by Hugging Face · Library · also known as Hugging Face Transformers, 🤗 Transformers, transformers (PyPI)
Hugging Face's model-definition library for text, vision, audio, video and multimodal models, with Pipeline, Trainer and generate APIs used as the reference by training and inference engines
Overview
Transformers is Hugging Face's Apache-2.0 Python library that defines pretrained model architectures and the code to load, run and train them. Its documentation now positions it as the model-definition framework for the ecosystem: when an architecture is implemented in Transformers, training frameworks (Axolotl, Unsloth, DeepSpeed, FSDP), inference engines (vLLM, SGLang, TGI) and adjacent libraries (llama.cpp, MLX) can reuse that definition. More than a million checkpoints on the Hugging Face Hub target the library, which is at version 5.x in 2026.
Three APIs cover most use: pipeline for one-line inference across tasks such as text generation, speech recognition and image segmentation; Trainer for PyTorch training with mixed precision, torch.compile, FlashAttention and distributed backends; and generate for decoding with streaming and multiple strategies. Each model is built from a configuration, a model class and a preprocessor, which keeps implementations readable and modifiable. The library is PyTorch-centric; earlier TensorFlow and JAX paths have been de-emphasized. Typical limits are that it is not an optimized serving engine, that memory use for large models requires companion libraries such as Accelerate or bitsandbytes, and that the rapid release pace introduces API changes between major versions.
Capabilities
- Pretrained architectures for text, vision, audio, video and multimodal tasks
- `pipeline` one-line inference
- `Trainer` with mixed precision, distributed training and torch.compile
- `generate` with streaming and multiple decoding strategies
- Shared model definitions reused by vLLM, llama.cpp, MLX, Axolotl and others
- Tight integration with the Hugging Face Hub for loading and pushing checkpoints
Typical workflows
- Load a Hub checkpoint and run inference in a few lines
- Fine-tune a classifier or LLM with Trainer and push it to the Hub
- Export a model definition to an inference engine such as vLLM
Strengths
- Largest catalog of ready-to-load architectures
- Readable per-model implementations
- Stable Apache-2.0 license and active maintenance
Limitations
- Not a production serving engine
- Large models need companion libraries for memory efficiency
- Breaking changes across major versions
Prerequisites
- Python with PyTorch
- Hugging Face Hub access for checkpoints
Who it is for
- ML researchers and engineers
- Developers fine-tuning or evaluating models
- Library authors building on shared model definitions
Alternatives & comparison
- Axolotl
YAML-configured open-source framework for fine-tuning and post-training LLMs: full, LoRA and QLoRA training, preference and RL methods, multimodal models and multi-GPU or multi-node runs
Open sourceOpen source - Hugging Face Hub
Hosting platform for open models, datasets and Spaces demo apps built on git repositories and Xet storage, with Inference Providers, Endpoints, Jobs and an open-source Python client and CLI
MixedFreemium - MLX LM
Python package and CLI for running, serving, quantizing and fine-tuning large language models on Apple Silicon with MLX
Open sourceOpen source - PyTorch
Open-source deep-learning framework with eager tensors, autograd, torch.compile and distributed training, governed by the PyTorch Foundation and the base of most LLM tooling
Open sourceOpen source - Sentence Transformers
Python library for computing and training embedding, cross-encoder reranker, sparse and multi-vector retrieval models, maintained by Hugging Face with thousands of pretrained models on the Hub
Open sourceOpen source - Unsloth
Open-source framework for fine-tuning and running LLMs with reduced memory, covering LoRA, QLoRA, full fine-tuning and RL, GGUF export, Dynamic quantizations and a local Studio/Desktop UI
Open sourceOpen source - vLLM
High-throughput LLM inference and serving engine with PagedAttention, continuous batching, quantization and an OpenAI-compatible server for GPU and accelerator clusters
Open sourceOpen source
Sources & verification
Primary sources consulted for this record. Claims are tied to the fields each source supports; the automated link checker re-verifies every URL on a schedule.
- Licensehttps://github.com/huggingface/transformers/blob/main/LICENSEchecked Nov 1, 2026
Supports: license_spdx, source_model
- Official siteTransformers documentationchecked Nov 1, 2026
https://huggingface.co/docs/transformers/index
Supports: name, summary, capabilities, integrations
- Repositoryhttps://github.com/huggingface/transformerschecked Nov 1, 2026
Supports: license_spdx, languages
- Confidence
- High
- Reviewed
- Nov 1, 2026
- Links
- Verified · Nov 2, 2026
Spotted an error?
More in Training & fine-tuning
MLX
Apple Inc. · Apple Silicon ML & MLX
Apple's open-source array framework for machine learning on Apple Silicon, with NumPy-like Python, C++ and Swift APIs and unified CPU/GPU memory
Ray
Ray project (Anyscale and contributors) · Distributed & parallel computing
Open-source Python framework for distributing tasks, actors and ML workloads across a cluster, with libraries for data processing, training, tuning, serving and reinforcement learning
Hugging Face Hub
Hugging Face · Training & fine-tuning
Hosting platform for open models, datasets and Spaces demo apps built on git repositories and Xet storage, with Inference Providers, Endpoints, Jobs and an open-source Python client and CLI
scikit-learn
scikit-learn developers · Mathematical & statistical computing
BSD-licensed Python machine-learning library for classification, regression, clustering, dimensionality reduction, preprocessing and model selection on NumPy and SciPy
Unsloth
Unsloth AI · Training & fine-tuning
Open-source framework for fine-tuning and running LLMs with reduced memory, covering LoRA, QLoRA, full fine-tuning and RL, GGUF export, Dynamic quantizations and a local Studio/Desktop UI
Axolotl
Axolotl AI · Training & fine-tuning
YAML-configured open-source framework for fine-tuning and post-training LLMs: full, LoRA and QLoRA training, preference and RL methods, multimodal models and multi-GPU or multi-node runs