Hugging Face's Python library of model definitions for text, vision, audio and multimodal models
open sourceApache-2.0free
Transformers is Hugging Face's Python library that defines state-of-the-art machine learning models for text, vision, audio, video and multimodal tasks, for both inference and training, on PyTorch. It loads any of over a million compatible checkpoints from the Hugging Face Hub by name, and its Pipeline API runs a task (text generation, chat, speech recognition, image classification and more) in a few lines, downloading and caching the model. Its Trainer handles training and fine-tuning, and transformers serve and transformers chat run a model from the command line. Because the model definitions are shared, training tools such as Unsloth, Axolotl and DeepSpeed and inference engines such as vLLM, SGLang and llama.cpp build on them.
Problems it solves
- run an open source language model locally in Python
- fine-tune a pretrained model on my own text data
- transcribe audio with an open model in a Python script
- use the newest open-weights model the day it's released
- classify images with a pretrained vision model
Features
- model definitions for text, vision, audio, video and multimodal models
- loads 1M+ checkpoints from the Hugging Face Hub
- Pipeline API for inference
- Trainer for training and fine-tuning
- transformers serve and transformers chat commands
- works with training frameworks and inference engines that reuse its model definitions
Alternatives
The same job
These do what Transformers does.
- Diffusers State-of-the-art diffusion models for image, video, and audio generation in PyTorch
