Tools · SPBoucher
Menu

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

Apache-2.0 licenseOpen sourceFreeLocalSelf-hostedSelf-hostable
Visit official site Compare

Link verified Nov 2, 2026

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

  1. Load a Hub checkpoint and run inference in a few lines
  2. Fine-tune a classifier or LLM with Trainer and push it to the Hub
  3. 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
Compare Transformers with its alternatives →

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.

Confidence
High
Reviewed
Nov 1, 2026
Links
Verified · Nov 2, 2026

Spotted an error?

Broken link, outdated license, wrong category, or a tool that no longer exists? Tell us; reports are reviewed by the editor.

MLX

Apple Inc. · Apple Silicon ML & MLX

In-depth entry

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

MITOpen sourceFreeLocalNov 2, 2026

Ray

Ray project (Anyscale and contributors) · Distributed & parallel computing

In-depth entry

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

Apache-2.0Open sourceFreeLocalSelf-hostedBroken

Hugging Face Hub

Hugging Face · Training & fine-tuning

In-depth entry

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

MixedFreemiumPaidLocalNov 2, 2026

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

BSD-3-ClauseFreeOpen sourceLocalNov 2, 2026

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

Apache-2.0Open sourceFreeLocalSelf-hostedNov 2, 2026

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

Apache-2.0Open sourceFreeSelf-hostedNov 2, 2026