TechnologyMachine learning library

Hugging Face Transformers

Also known as: Transformers, pytorch-pretrained-bert

Open-source Python library from Hugging Face that provides a common interface for loading, running and fine-tuning thousands of pretrained models.

Hugging Face Transformers is an open-source Python library that gives a common interface for downloading, running, fine-tuning and sharing pretrained machine learning models, especially those based on the transformer architecture. A few lines of code can load a model and its tokenizer from the Hugging Face Hub and apply it to tasks such as text generation, translation, summarization, question answering, image classification or speech recognition. High-level pipelines hide most details, while lower-level classes expose model internals for research and customization.

The library began in 2018 as pytorch-pretrained-bert, a port of Google's BERT language model to PyTorch, released by the company Hugging Face. It was renamed pytorch-transformers and then Transformers in 2019 as it grew to cover many model families and added TensorFlow support. Its design pairs each architecture with standard configuration, tokenizer and model classes, so that thousands of community and research checkpoints on the Hub can be loaded the same way. A Trainer utility and companion libraries handle Fine-Tuning, datasets, evaluation and efficient inference.

Transformers became a de facto standard for distributing open-weight models: research labs often publish a compatible implementation when they release model weights, and many tutorials in natural language processing build on it. By standardizing how models are loaded and shared, it lowered the barrier to experimenting with advanced systems and made reproducing results easier. Users still need to check each model's license, intended uses and known limitations, which vary widely between checkpoints and are documented, with varying completeness, in model cards on the Hub.

Key points

  • The library loads pretrained models and tokenizers from the Hugging Face Hub through a uniform API.
  • It covers text, vision, audio and multimodal tasks through high-level pipelines and lower-level classes.
  • Transformers began in 2018 as a PyTorch port of Google's BERT model.
  • Many open-weight model releases include a Transformers-compatible implementation for easy adoption.

Related entries

Organization

Company that runs a widely used platform for sharing machine learning models, datasets and demos and maintains popular open-source AI libraries.

Glossary term

Neural network architecture based on self-attention, introduced in 2017, that underlies most large language models and many vision and audio models.

Technology

PyTorch

AIProgrammingFOSS

Open-source machine learning framework combining GPU-accelerated tensors with automatic differentiation, widely used for deep learning research.

Glossary term

Neural network trained on very large amounts of text to predict the next token, able to generate language and perform many tasks from prompts.

Glossary term

AI model whose trained weights are publicly released for download, letting others run, study and adapt it, though often under restrictive licenses.

Glossary term

Further training of a pretrained model on a smaller, task-specific dataset so that it adapts its behavior to a particular domain, style or task.

Glossary term

The process of splitting text into smaller units called tokens, such as words, subwords or characters, that a language model can process as numbers.

Technology

Family of large language models from Meta, distributed as downloadable weights that developers can run, study and adapt on their own hardware.

Featured in guides

Referenced by

Other entries that discuss or point to Hugging Face Transformers.