• Get started
  • 🤗 Transformers
  • Quick tour
  • Installation
  • Tutorials
  • Run inference with pipelines
  • Write portable code with AutoClass
  • Preprocess data
  • Fine-tune a pretrained model
  • Train with a script
  • Set up distributed training with 🤗 Accelerate
  • Load and train adapters with 🤗 PEFT
  • Share your model
  • Agents
  • Generation with LLMs
  • Chatting with Transformers
  • Task Guides
  • Natural Language Processing
  • Text classification
  • Token classification
  • Question answering
  • Causal language modeling
  • Masked language modeling
  • Translation
  • Summarization
  • Multiple choice
  • Audio
  • Audio classification
  • Automatic speech recognition
  • Computer Vision
  • Image classification
  • Image segmentation
  • Video classification
  • Object detection
  • Zero-shot object detection
  • Zero-shot image classification
  • Depth estimation
  • Image-to-Image
  • Image Feature Extraction
  • Mask Generation
  • Knowledge Distillation for Computer Vision
  • Multimodal
  • Image captioning
  • Document Question Answering
  • Visual Question Answering
  • Text to speech
  • Image-text-to-text
  • Generation
  • Customize the generation strategy
  • Best Practices for Generation with Cache
  • Prompting
  • Image tasks with IDEFICS
  • LLM prompting guide
  • Developer guides
  • Use fast tokenizers from 🤗 Tokenizers
  • Run inference with multilingual models
  • Use model-specific APIs
  • Share a custom model
  • Chat templates
  • Trainer
  • Run training on Amazon SageMaker
  • Export to ONNX
  • Export to TFLite
  • Export to TorchScript
  • Benchmarks
  • Notebooks with examples
  • Community resources
  • Troubleshoot
  • Interoperability with GGUF files
  • Quantization Methods
  • Getting started
  • bitsandbytes
  • GPTQ
  • AWQ
  • AQLM
  • Quanto
  • EETQ
  • HQQ
  • FBGEMM_FP8
  • Optimum
  • TorchAO
  • Contribute new quantization method
  • Performance and scalability
  • Overview
  • LLM inference optimization
  • Efficient training techniques
  • Methods and tools for efficient training on a single GPU
  • Multiple GPUs and parallelism
  • Fully Sharded Data Parallel
  • DeepSpeed
  • Efficient training on CPU
  • Distributed CPU training
  • Training on TPU with TensorFlow
  • PyTorch training on Apple silicon
  • Custom hardware for training
  • Hyperparameter Search using Trainer API
  • Optimizing inference
  • CPU inference
  • GPU inference
  • Instantiate a big model
  • Debugging
  • XLA Integration for TensorFlow Models
  • Optimize inference using `torch.compile()`
  • Contribute
  • How to contribute to 🤗 Transformers?
  • How to add a model to 🤗 Transformers?
  • How to add a pipeline to 🤗 Transformers?
  • Testing
  • Checks on a Pull Request
  • Conceptual guides
  • Philosophy
  • Glossary
  • What 🤗 Transformers can do
  • How 🤗 Transformers solve tasks
  • The Transformer model family
  • Summary of the tokenizers
  • Attention mechanisms
  • Padding and truncation
  • BERTology
  • Perplexity of fixed-length models
  • Pipelines for webserver inference
  • Model training anatomy
  • Getting the most out of LLMs
  • API
  • Main Classes
  • Agents and Tools
  • Auto Classes
  • Backbones
  • Callbacks
  • Configuration
  • Data Collator
  • Keras callbacks
  • Logging
  • Models
  • Text Generation
  • ONNX
  • Optimization
  • Model outputs
  • Pipelines
  • Processors
  • Quantization
  • Tokenizer
  • Trainer
  • DeepSpeed
  • Feature Extractor
  • Image Processor
  • Models
  • Text models
  • Vision models
  • Audio models
  • Video models
  • Multimodal models
  • Reinforcement learning models
  • Time series models
  • Graph models
  • Internal Helpers
  • Custom Layers and Utilities
  • Utilities for pipelines
  • Utilities for Tokenizers
  • Utilities for Trainer
  • Utilities for Generation
  • Utilities for Image Processors
  • Utilities for Audio processing
  • General Utilities
  • Utilities for Time Series
  • 🤗 Transformers

    State-of-the-art Machine Learning for PyTorch, TensorFlow, and JAX.

    🤗 Transformers provides APIs and tools to easily download and train state-of-the-art pretrained models. Using pretrained models can reduce your compute costs, carbon footprint, and save you the time and resources required to train a model from scratch. These models support common tasks in different modalities, such as:

    📝 Natural Language Processing: text classification, named entity recognition, question answering, language modeling, summarization, translation, multiple choice, and text generation.
    🖼️ Computer Vision: image classification, object detection, and segmentation.
    🗣️ Audio: automatic speech recognition and audio classification.
    🐙 Multimodal: table question answering, optical character recognition, information extraction from scanned documents, video classification, and visual question answering.

    🤗 Transformers support framework interoperability between PyTorch, TensorFlow, and JAX. This provides the flexibility to use a different framework at each stage of a model's life; train a model in three lines of code in one framework, and load it for inference in another. Models can also be exported to a format like ONNX and TorchScript for deployment in production environments.

    Join the growing community on the Hub, forum, or Discord today!

    If you are looking for custom support from the Hugging Face team

    Contents

    The documentation is organized into five sections:

    • GET STARTED provides a quick tour of the library and installation instructions to get up and running.
    • TUTORIALS are a great place to start if you're a beginner. This section will help you gain the basic skills you need to start using the library.
    • HOW-TO GUIDES show you how to achieve a specific goal, like finetuning a pretrained model for language modeling or how to write and share a custom model.
    • CONCEPTUAL GUIDES offers more discussion and explanation of the underlying concepts and ideas behind models, tasks, and the design philosophy of 🤗 Transformers.
    • API describes all classes and functions:

    • MAIN CLASSES details the most important classes like configuration, model, tokenizer, and pipeline.

    • MODELS details the classes and functions related to each model implemented in the library.
    • INTERNAL HELPERS details utility classes and functions used internally.

    Supported models and frameworks

    The table below represents the current support in the library for each of those models, whether they have a Python tokenizer (called "slow"). A "fast" tokenizer backed by the 🤗 Tokenizers library, whether they have support in Jax (via Flax), PyTorch, and/or TensorFlow.