transformers
Frameworkhuggingface/transformers
State-of-the-art pretrained models for inference and training across modalities.
Overview
Hugging Face Transformers is a model-definition framework providing thousands of pretrained models for text, vision, audio, and multimodal tasks. It supports both inference and training, and is compatible with major training frameworks and inference engines. The library centralizes model definitions so the AI ecosystem can build interoperable tools.
README Preview
\n\n\n \n \n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n\n\n\n \n English |\n 简体中文 |\n 繁體中文 |\n 한국어 |\n Español |\n 日本語 |\n हिन्दी |\n Русский |\n Português |\n తెలుగు |\n Français |\n Deutsch |\n Italiano |\n Tiếng Việt |\n العربية |\n اردو |\n বাংলা |\n فارسی |\n Türkçe |\n \n\n\n\n State-of-the-art pretrained models for inference and training\n\n\n\n \n\n\nTransformers acts as the model-definition framework for state-of-the-art machine learning with text, computer\nvision, audio, video, and multimodal models, for both inference and training.\n\nIt centralizes the model definition so that this definition is agreed upon across the ecosystem. `transformers` is the\npivot across frameworks: if a model definition is supported, it will be compatible with the majority of training\nframeworks (Axolotl, Unsloth, DeepSpeed, FSDP, PyTorch-Lightning, ...), inference engines (vLLM, SGLang, TGI, ...),\nand adjacent modeling libraries (llama.cpp, mlx, ...) which leverage the model definition from `transformers`.\n\nWe pledge to help support new state-of-the-art models and democratize their usage by having their model definition be\nsimple, customizable, and efficient.\n\nThere are over 1M+ Transformers [model checkpoints](https://huggingface.co/models?library=transformers&sort=trending) on the [Hugging Face Hub](https://huggingface.co/models) you can use.\n\nExplore the [Hub](https://huggingface.co/) today to find a model and use Transformers to help you get started right away.\n\n## Installation\n\nTransformers works with Python 3.10+, and [PyTorch](https://pytorch.org/get-started/locally/) 2.5+.\n\nCreate and activate a virtual environment with [venv](https://docs.python.org/3/library/venv.html) or [uv](https://docs.astral.sh/uv/), a fast Rust-based Python package and project manager.\n\n```py\n# venv\