huggingface/transformers

★ 169,208⑂ 35,230

🤗 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.

About huggingface/transformers

huggingface/transformers is an open-source project on GitHub, mainly written in Python. 🤗 Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models It currently holds 169,208 stars and 35,230 forks with 1,109 open issues, and was last pushed on 2026-11-18 (repository created 2018-10-29).

Project Overview

Git Homed tracks it on the Audio Trending board and on the AI Audio Trending list.

GitHub Repository Details

Repository huggingface/transformers · default branch main · size 568027 KB · watchers 1,279 · source: GitHub REST API and repository README

README

https://github.com/huggingface/transformers/blob/HEAD/Hugging Face Transformers Library

https://github.com/huggingface/transformers/blob/HEAD/Checkpoints on Hub https://github.com/huggingface/transformers/blob/HEAD/Build https://github.com/huggingface/transformers/blob/HEAD/GitHub https://github.com/huggingface/transformers/blob/HEAD/Documentation https://github.com/huggingface/transformers/blob/HEAD/GitHub release https://github.com/huggingface/transformers/blob/HEAD/Contributor Covenant https://github.com/huggingface/transformers/blob/HEAD/DOI

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 is the model-definition framework for machine learning models in text, computer vision, audio, video, and multimodal tasks. It defines each model once, in PyTorch, and you use that definition for both inference and training.

Training frameworks, inference engines, and local runtimes build on that definition instead of writing their own. Transformers adds new architectures as they're released and matches each one to its original results, so those tools get each new model as soon as it's added.

https://github.com/huggingface/transformers/blob/HEAD/Unsloth
Fine-tune with less memory. Unsloth trains LLMs in 4-bit, 8-bit, and 16-bit precision with custom kernels.
https://github.com/huggingface/transformers/blob/HEAD/vLLM
Serve LLMs at scale. vLLM batches requests continuously and keeps KV cache memory compact with PagedAttention.
https://github.com/huggingface/transformers/blob/HEAD/SGLang
Serve LLMs with low latency. SGLang is a high-throughput inference engine with a frontend language for agentic workflows.
https://github.com/huggingface/transformers/blob/HEAD/llama.cpp
Run LLMs locally without Python. llama.cpp is a C/C++ inference engine that runs quantized models in the GGUF format.

Transformers standardizes how every model is written, so hundreds of architectures share one structure. Each model is one file that reads from top to bottom and stays simple without giving up performance. An improvement made once reaches every architecture, so if you find one, contribute it.

Transformers is designed to be read and modified by humans and coding agents alike. To swap how a model computes, register your own attention or experts function, or load an optimized kernel from the Hub, and the model uses it without edits to its code.

Try a model

Install Transformers with PyTorch. See the Installation guide for other setups.

uv pip install "transformers[torch]"

Create a Pipeline with a chat model from the Hugging Face Hub and pass it a message.

from transformers import pipeline

pipe = pipeline(task="text-generation", model="Qwen/Qwen3-0.6B") messages = [ {"role": "user", "content": "What's the secret to baking a really good cake? Answer in one sentence."}, ] output = pipe(messages, tokenizer_encode_kwargs={"enable_thinking": False}) print(output[0]["generated_text"][-1]["content"])

The secret to baking a really good cake is combining the perfect balance of ingredients, technique, and a warm, loving atmosphere.

The Quickstart covers loading models, running inference on other tasks, and training.

Set up your coding agent

Copy the prompt below into your coding agent. It has the agent check your installed version, read the docs for that version, and use the current Transformers v5 APIs.

I'm building with Hugging Face Transformers. Before you write any Transformers code:

1. Check the installed version with python -c "import transformers; print(transformers.__version__)". If Transformers isn't installed, install it with pip install "transformers[torch]". 2. Read the docs index for that version at https://huggingface.co/docs/transformers/v/llms.txt, for example v5.22.2. For a .dev version, use https://huggingface.co/docs/transformers/main/llms.txt. Add .md to any docs page URL to read it as Markdown. Look up each class and argument there instead of relying on memory. 3. If the version is 5.0 or later, read https://github.com/huggingface/transformers/blob/main/MIGRATION_GUIDE_V5.md. Don't use APIs from older versions. 4. Read the model card of each model you use on the Hugging Face Hub. Many models need specific arguments, like a chat template option or a minimum Transformers version.

Run inference

Load a pretrained model and run it on text, images, audio, video, or any combination of modalities.

Serve models

Serve a model to other applications over HTTP. transformers serve is for evaluation, experimentation, and moderate load. For large production deployments, use an inference engine with a Transformers model as the backend.

Train models

Fine-tune a pretrained model on your data, on one GPU or many.

Use less memory and run faster

Fit a model on your hardware and speed it up.

Add or change a model

Add a model to Transformers or edit an existing one.

Citation

We now have a paper you can cite for the 🤗 Transformers library:

@inproceedings{wolf-etal-2020-transformers,
    title = "Transformers: State-of-the-Art Natural Language Processing",
    author = "Thomas Wolf and Lysandre Debut and Victor Sanh and Julien Chaumond and Clement Delangue and Anthony Moi and Pierric Cistac and Tim Rault and Rémi Louf and Morgan Funtowicz and Joe Davison and Sam Shleifer and Patrick von Platen and Clara Ma and Yacine Jernite and Julien Plu and Canwen Xu and Teven Le Scao and Sylvain Gugger and Mariama Drame and Quentin Lhoest and Alexander M. Rush",
    booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
    month = oct,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2020.emnlp-demos.6/",
    pages = "38--45"
}

GitHub Stars & Activity

169,208Stars
35,230Forks
1,109Open issues
PythonLanguage

GitHub Popularity

GitHub stars169,208
Forks35,230
Open issues1,109
Primary languagePython
LicenseApache-2.0
Stars gained today0
Created2018-10-29
Last pushed2026-11-18

Trending History

Trending statusnot on today's boards

Related GitHub Projects

1

debpalash / VoiceStudio

Python★ 118,066⑂ 0
→
2

bilibili / GPT-SoVITS

Python★ 64,255⑂ 0
→
3

coqui-ai / TTS

Python★ 46,279⑂ 0
→
4

OpenBMB / VoxCPM

Python★ 42,973⑂ 0
→
5

2noise / ChatTTS

Python★ 40,035⑂ 0
→
6

myshell-ai / OpenVoice

Python★ 38,320⑂ 0
→
7

babysor / MockingBird

Python★ 36,854⑂ 0
→
8

SYSTRAN / faster-whisper

Python★ 27,005⑂ 0
→

More Trending Repositories