Skip to main content

πŸ€— Transformers

Hugging Face Transformers is the model-definition framework for state-of-the-art text, vision, audio, video and multimodal models β€” for both inference and training.

Adapted for this playbook from the πŸ€— Transformers documentation by Hugging Face. Official page: https://huggingface.co/docs/transformers/index. Images Β© Hugging Face (documentation-images) unless noted. This is not a substitute for the upstream docs β€” verify against the current version.

Transformers as a model-definition framework across the ecosystem β€” Source: Hugging Face Transformers documentation

Source: Hugging Face Transformers documentation (transformers_as_a_model_definition.png).

Why Transformers matters​

Hugging Face positions transformers as the pivot across the ecosystem: if a model definition is supported here, it is compatible with most training stacks (Axolotl, Unsloth, DeepSpeed, FSDP, …), inference engines (vLLM, SGLang, TGI, …) and adjacent libraries (llama.cpp, MLX, …).

There are 1M+ Transformers model checkpoints on the Hub.

Hugging Face Transformers hub / expert programme banner β€” Source: Hugging Face

Source: Hugging Face Transformers documentation.

Design principles (summary)​

  1. Fast and easy to use β€” each model is configuration + model + preprocessor; use Pipeline or Trainer quickly.
  2. Pretrained models β€” reuse checkpoints instead of training from scratch; reduce carbon, cost and time.
  3. Three core classes β€” configuration, model, preprocessor (from_pretrained / save_pretrained / push_to_hub).

See Philosophy for the full tenets.

How this playbook maps to Hugging Face docs​

Playbook sectionHugging Face docs areaStart here
Get startedInstallation, Quickstart, PhilosophyInstallation
Base classesModels, PreprocessorsLoading models
InferencePipeline, Generate, Optimisation, Chat, ServingPipeline
TrainingTrainer, PEFT, distributed, hardwareTrainer
QuantizationQuantization guidesConcepts
EcosystemCommunity integrationsInference engines
TasksTask how-tosNLP tasks
ResourcesGlossary, timeline, troubleshootingGlossary
Flagship modelsSelected model_doc deep divesBERT
API mapMain classes + full model API on HFAPI map

Credit policy​

Every page in this section:

  • Credits Hugging Face and links to the official Transformers doc URL
  • Hosts selected diagrams from Hugging Face documentation-images with figure captions
  • Rewrites content for playbook clarity (British spelling, enterprise notes) rather than mirroring API reference dumps
  • Does not replace the upstream docs β€” always verify against huggingface.co/docs/transformers

Hugging Face logo β€” Source: Hugging Face brand assets

Source: Hugging Face brand assets.

Learning path​

  1. Installation β†’ Quickstart β†’ Philosophy
  2. Pipeline for fast inference; Loading models when you need control
  3. Text generation and Chat for LLMs
  4. Fine-tuning + PEFT for adaptation
  5. Quantization and Serving for production

Discussion

Comments​

Share feedback or questions about this page. No account required.

Loading comments…