Hugging Face Transformers Tutorial
Welcome to the Hugging Face tutorial. The homepage card is titled Hugging Face; the content focuses on the Transformers library and the Hub (models, datasets, Spaces). It follows the official Transformers docs and huggingface/transformers—from first inference to fine-tuning and sharing.
Transformers is the model-definition framework for text, vision, audio, video, and multimodal models. The Hub hosts 1M+ checkpoints. Runnable examples use ungated small models so you are not blocked by Llama-style license walls.
Table of Contents
Basics
- Introduction — Hub, Transformers, the ecosystem, and how this course relates to PyTorch / Ollama
- Installation — venv, PyTorch,
transformers,hf auth login; GPU optional - Quick Start — Classification or generation with
pipeline
Core APIs
- Pipeline — Task table; text, vision, and audio examples
- Tokenizers and Models —
AutoTokenizer,AutoModelForCausalLM, encode / decode - Text Generation —
generate(), greedy vs sampling,max_new_tokens
Data and Training
- Datasets —
load_dataset,map,DataCollator - Fine-tuning —
Trainer+rotten_tomatoes, or LoRA on a small causal LM - The Hub — Search, model cards,
push_to_hub, Spaces teaser
Practice
- Practical Examples — Sentiment, a RAG-less chatbot, fine-tune outline
- Resources — Official docs and related courses on this site
Learning path
Models used here (all publicly downloadable)
Related courses on this site
- Tensors and training loops: start with the PyTorch tutorial, then return for
Trainer/generate(). - Local chat only: the Ollama tutorial is easier; this course is for research, fine-tuning, and custom pipelines.
- Coding agents: Hugging Face Skills (
SKILL.md) can drive Hub operations—not the main path here.
Prerequisites
- Python 3.10+ (functions, virtual environments)
- The idea of pretrain → fine-tune → infer; you do not need to implement Transformer blocks
- A GPU helps; classification and tiny generation work on CPU
Study tips
- Follow the chapter order; every page has runnable code
- First downloads fill the Hub cache—leave disk space
- If you hit a gated repo, switch to the ungated IDs listed above
- Read the model card (license, VRAM) before fine-tuning
- Coding agents can use Hugging Face Skills—run a Pipeline yourself first