Hugging Face Transformers

Learn Hugging Face Transformers: pipelines, tokenizers, Auto models, text generation, datasets, fine-tuning with Trainer, LoRA, quantization and safe serving.

Learn Hugging Face Transformers free, in English or Hindi, with lessons, shorts and interview questions.

Start course → · Interview questions

33 lessons · 10 modules · Free

What you'll learn

  • Explain the Hugging Face ecosystem, the Transformer architecture and the encoder, decoder and encoder-decoder families.
  • Run pretrained models with pipelines and with tokenizers and Auto classes directly, reading logits and outputs correctly.
  • Control text generation with decoding strategies, length limits and chat templates.
  • Load, transform and split data with the datasets library and fine-tune models with Trainer or Accelerate.
  • Fit large models on small GPUs with LoRA, 4-bit quantization and QLoRA, and merge adapters for serving.
  • Serve models efficiently and safely using batching, safetensors, pinned revisions and protected tokens.

Syllabus

Mental Model and Setup

  1. What Hugging Face Actually Is
  2. The Transformer in Ten Minutes
  3. Setting Up Your Environment

Pipelines: Results in Minutes

  1. Your First Pipeline
  2. A Tour of Pipeline Tasks
  3. Devices, Batching and Precision in Pipelines

Tokenizers: Text to Numbers

  1. Why Models Read Subwords
  2. AutoTokenizer: Encode and Decode
  3. Padding, Truncation and Batches

Models, Auto Classes and Outputs

  1. Auto Classes, Configs and Heads
  2. Running a Model by Hand
  3. Picking the Right Model Family

Text Generation and Chat Models

  1. How generate() Writes Text
  2. Decoding Strategies: Greedy, Sampling, Beams
  3. Chat Models and Chat Templates

The Hub and the datasets Library

  1. Working with Hub Repositories
  2. Saving and Sharing Your Models
  3. Loading Data with the datasets Library
  4. Transforming Datasets with map and filter

Fine-Tuning with Trainer and Accelerate

  1. Why Fine-Tuning Works
  2. Training with Trainer
  3. Evaluation and Metrics
  4. Custom Training Loops with Accelerate

Efficient Fine-Tuning and Quantization

  1. LoRA and Parameter-Efficient Fine-Tuning
  2. Quantization: Fitting Big Models on Small GPUs
  3. QLoRA: Fine-Tuning on One Consumer GPU

Production: Performance, Security and Pitfalls

  1. Making Inference Faster
  2. Serving Models in Production
  3. Security: Remote Code, Pickles and Tokens
  4. Common Pitfalls and How to Spot Them

Revision and Interview Prep

  1. Cheat Sheet: The Whole Course on One Page
  2. Common Interview and Exam Questions
  3. Mixed Self-Check

Related courses