transformers
Model-definition library for text, vision, audio and multimodal models
Transformers is a Python library that defines model architectures for text, vision, audio, video and multimodal models and loads pretrained checkpoints from the Hugging Face Hub. It offers a Pipeline API for inference, a PyTorch-based training API, and `transformers serve` and `transformers chat` commands. Other training frameworks and inference engines reuse its model definitions.
Strengths
- Hundreds of architectures and 1M+ Hub checkpoints behind one unified API
- Pipeline API covers text, audio, vision and multimodal tasks in a few lines
- Definitions are reused by Axolotl, Unsloth, DeepSpeed, vLLM, SGLang, TGI and others
- Model files are deliberately flat and usable independently of the library
Weaknesses
- Not a modular toolbox of neural net building blocks, per the README
- Training API targets Transformers' PyTorch models; generic loops should use Accelerate
- Example scripts are only examples and may need adapting
- Requires Python 3.10+ and PyTorch 2.6+; RAM and GPU needs are not stated
- GPU optional
- Docker
- Needs Python 3.10+, PyTorch 2.6+, Hugging Face Hub
- Models: PyTorch, Hugging Face Hub checkpoints, text, vision, audio