transformers

πŸ€— Transformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference a

What is 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.

Overview of transformers

What it is

Transformers is a model-definition framework for state-of-the-art machine learning models in text, vision, audio, video, and multimodal modalities. It centralizes model definitions so they are agreed upon across the ecosystem, making models compatible with training frameworks (Axolotl, Unsloth, DeepSpeed, FSDP, PyTorch-Lightning), inference engines (vLLM, SGLang, TGI), and adjacent modeling libraries (llama.cpp, mlx). Over 1 million Transformers model checkpoints are available on the Hugging Face Hub.

Key features

  • Easy-to-use state-of-the-art models with high performance on natural language understanding & generation, computer vision, audio, video, and multimodal tasks.
  • Low barrier to entry with few user-facing abstractions (three classes to learn) and a unified API for all pretrained models.
  • Lower compute costs and smaller carbon footprint by sharing trained models instead of training from scratch.
  • Hundreds of model architectures with 1M+ pretrained checkpoints across all modalities.
  • Choose the right framework for each part of a model's lifetime: train in 3 lines of code, move between PyTorch/JAX/TF2.0, and pick the right framework for training, evaluation, and production.
  • Easily customize a model or example; model internals are exposed consistently and model files can be used independently.

Use cases

  • Text tasks: natural language understanding and generation, chat, text generation.
  • Audio tasks: automatic speech recognition.
  • Vision tasks: image classification, visual question answering.
  • Multimodal tasks: combining text, vision, audio, video.
  • Training and inference across all supported modalities.

Getting started

Create and activate a virtual environment, then install Transformers with PyTorch support. py # venv python -m venv .my-env source .my-env/bin/activate # uv uv venv .my-env source .my-env/bin/activate py # pip pip install 'transformers[torch]' # uv uv pip install 'transformers[torch]' For the latest changes, install from source: shell git clone https://github.com/huggingface/transformers.git cd transformers # pip pip install '.[torch]' # uv uv pip install '.[torch]' Quickstart with the Pipeline API: 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 ')

License and pricing

Licensed under Apache-2.0. Open source, no pricing stated.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/huggingfacetransformers.svg)](https://yunodb.com/tools/huggingfacetransformers?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/huggingfacetransformers?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/huggingfacetransformers.svg" alt="Featured on YunoDB" height="20"></a>