# transformers

> Hugging Face model-definition framework for text, vision, audio and multimodal models, for inference and training.

- Type: agent or tool
- Field: ML & AI
- Repository: https://github.com/huggingface/transformers
- GitHub stars: 169441
- Licence: Apache-2.0
- Language: Python
- Last push: 2026-12-01
- Page: https://imutechz.in/agents/transformers

## What it is
Transformers centralizes model definitions so they can be shared across training frameworks, inference engines and related libraries. It targets people who want to run or train pretrained models for text, vision, audio, video and multimodal tasks. The Pipeline API gives a high-level way to run inference, and models are downloaded from the Hugging Face Hub and cached. It needs Python 3.11 or later and PyTorch 2.6 or later.

## Features
- Pipeline API for text, audio, vision and multimodal tasks
- Chat with a model from the command line with transformers chat
- Model checkpoints from the Hugging Face Hub
- Compatible model definitions across many training and inference tools
- Install with pip or uv

## Best for
- Running pretrained models in Python
- Speech recognition and image classification
- Fine-tuning and training models
- Building on a shared model definition

## Pros
- One API across many modalities
- Downloads and caches models automatically
- Install from source for latest changes

## Cons
- Requires Python 3.11+ and PyTorch 2.6+
- Latest source version may not be stable

## Install
```
pip install "transformers[torch]"
uv pip install "transformers[torch]"
```

## Usage
```
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 ")
```

Tags: machine-learning, deep-learning, pytorch, llm, nlp, speech-recognition, python, inference
