huggingface /transformers

🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.

★ 168,994⑂ 35,210👁 1,283⑃ 30,063● 19,880▤ 284
PythonApache-2.0Created 2018-10-29huggingface.co/transformers
Download: Release v5.23.0Release-5.23.0 ↓5.23.02026-11-13
+26
Daily
+310
Weekly
+1,405
Monthly
168,994
stars
35,210
forks
1,283
watchers
30,063
prs
19,880
issues
284
releases

README

English |
        简体中文 |
        繁體中文 |
        한국어 |
        Español |
        日本語 |
        हिन्दी |
        मराठी |
        Русский |
        Português |
        తెలుగు |
        Français |
        Deutsch |
        Italiano |
        Tiếng Việt |
        العربية |
        اردو |
        বাংলা |
        فارسی |
        Română |
        Türkçe
    



    State-of-the-art pretrained models for inference and training



    


Transformers acts as the model-definition framework for state-of-the-art machine learning with text, computer
vision, audio, video, and multimodal models, for both inference and training.

It centralizes the model definition so that this definition is agreed upon across the ecosystem. transformers is the
pivot across frameworks: if a model definition is supported, it will be compatible with the majority of training
frameworks (Axolotl, Unsloth, DeepSpeed, FSDP, PyTorch-Lightning, ...), inference engines (vLLM, SGLang, TGI, ...),
and adjacent modeling libraries (llama.cpp, mlx, ...) which leverage the model definition from transformers.

We pledge to help support new state-of-the-art models and democratize their usage by having their model definition be
simple, customizable, and efficient.

There are over 1M+ Transformers model checkpoints on the Hugging Face Hub you can use.

Explore the Hub today to find a model and use Transformers to help you get started right away.

 Installation

Transformers works with Python 3.11+, and PyTorch 2.6+.

Create and activate a virtual environment with venv or uv, a fast Rust-based Python package and project manager.

py
 venv
python -m venv .my-env
source .my-env/bin/activate
 uv
uv venv .my-env
source .my-env/bin/activate


Install Transformers in your virtual environment.

py
 pip
pip install "transformers[torch]"

 uv
uv pip install "transformers[torch]"


Install Transformers from source if you want the latest changes in the library or are interested in contributing. However, the latest version may not be stable. Feel free to open an issue if you encounter an error.

shell
git clone https://github.com/huggingface/transformers.git
cd transformers

 pip
pip install '.[torch]'

 uv
uv pip install '.[torch]'


 Quickstart

Get started with Transformers right away with the Pipeline API. The Pipeline is a high-level inference class that supports text, audio, vision, and multimodal tasks. It handles preprocessing the input and returns the appropriate output.

Instantiate a pipeline and specify model to use for text generation. The model is downloaded and cached so you can easily reuse it again. Finally, pass some text to prompt the model.

py
from transformers import pipeline

pipeline = pipeline(task="text-generation", model="Qwen/Qwen2.5-1.5B")
pipeline("the secret to baking a really good cake is ")
[{'generated_text': 'the secret to baking a really good cake is 1) to use the right ingredients and 2) to follow the recipe exactly. the recipe for the cake is as follows: 1 cup of sugar, 1 cu

Top issues

Latest release

Release v5.23.0 v5.23.0 2026-11-13
Release v5.23.0


 New Model additions

 Inkling2



Inkling 2 Small is a multimodal model from Thinking Machines Lab that accepts text and image inputs and generates text outputs, and it is intended for use in English and other languages and across multiple coding languages. Its language backbone has 48 mixture-of-experts decoder layers, each routing tokens to 8 of 384 experts, for 594B total and 17B active parameters. It keeps the Inkling decoder (learned relative attention, short causal convolutions, mixture-of-experts layers) and adds block attention residuals, gated attention wit

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON