Transformers
Reference PyTorch implementations of thousands of pretrained models, with pipelines, a trainer and a server.
About
Hugging Face's Transformers library holds the reference Python implementation for a huge range of model architectures, from BERT and T5 through Llama, Qwen and Gemma to Whisper, SAM and vision-language models. Each architecture lives in a mostly self-contained file, and weights load from the Hub or a local folder with one from_pretrained call. The pipeline API covers quick inference for text generation, speech recognition, image classification and more, the Trainer class handles fine-tuning, and the transformers command adds a terminal chat client and a serve mode that answers OpenAI-style requests. Because Axolotl, Unsloth, vLLM, SGLang and other tools reuse these definitions, a model added here usually works across that ecosystem. Version 5 dropped TensorFlow and JAX to focus on PyTorch 2.5 or newer, with Python 3.10 or later; install with pip and the torch extra. Small models run on CPU, larger ones need a GPU. The code is Apache 2.0, but each checkpoint has its own license, so read the model card before shipping. Suited to ML engineers and researchers working across modalities.
Should you use Transformers?
Pick it when
Pick this when you want to load, fine-tune, or run pretrained text, vision, audio, or multimodal models through one consistent API, and need those model definitions to work with the wider training and serving tools around the Hub.
Look elsewhere when
It is a model-definition and research library, not a high-throughput server: serve LLMs at scale with vLLM, and use llama.cpp for CPU or laptop inference. Its TensorFlow and JAX support is historical, so plan on PyTorch.
Alternatives to Transformers
- vLLM
Purpose-built LLM server with PagedAttention and continuous batching for production traffic; inference only, and it expects a GPU, around 16 GB for typical models.
- llama.cpp
Runs quantized GGUF models on CPU-only laptops with minimal setup; far lighter, but inference only and limited to supported architectures.
- Sentence-Transformers
Narrower library for embeddings and rerankers built on top of Transformers; less code when retrieval is all you need.
- timm
Deeper catalog of vision backbones with training scripts and augmentations; the better pick for pure image classification work.
Reviews (0)
Leave a Review
No reviews yet. Be the first to review!
Details
- Category
- AI Frameworks & Libraries
- Price
- Free
- Platform
- Local/Desktop
- Difficulty
- Intermediate (3/5)
- License
- Apache-2.0
- Added
- Jan 29, 2026