Skip to content

Debug your training and get unstuck

Every lesson so far showed code that worked; this one is about what to do when it does not. You will learn to debug systematically and to ask for help effectively, the skills that actually determine how fast you move in applied AI. The source curriculum is the Hugging Face LLM Course, Chapter 8, freely available and Apache-2.0 licensed at huggingface.co/learn/llm-course/chapter8.

You will learn to read a Python traceback bottom to top to find the error; debug by forming a hypothesis about what kind of thing is wrong and checking it directly (walking through two real tracebacks); recognize the common places a training pipeline breaks (data and labels, tokenization, the collator, shapes and devices); build a minimal reproducible example; and ask for help on the forums or in a GitHub issue in a way that actually gets answered.

This is lesson 8 of 12, the close of Phase 2 (data, tokenizers, and tasks). Where the rest of the track teaches what to do, this lesson teaches what to do when it breaks, the debugging counterpart to everything from the Trainer loop (lesson 3) to the task pipelines (lesson 7). It is also the most transferable lesson: the skills apply to any open-source project. Phase 3 opens next with shipping a demo.

Prerequisites: lesson 3 (the Trainer fine-tuning loop, since the training pipeline you debug here is that loop). Lessons 6 and 7 help, because the worked errors involve tokenizers and a question-answering pipeline. No new installs. This lesson is process-focused; you can read it without a notebook, though the linked chapter has runnable debugging examples.

None. This is a methodology lesson: reading errors, checking hypotheses, and communicating clearly. The only code is two short, real tracebacks and their fixes, used to make the method concrete.

The single capability this lesson builds: diagnose common training-pipeline errors, debug systematically, and ask the community effectively. Concretely, you will be able to:

  • Read a Python traceback bottom to top to locate the error
  • Debug by forming a hypothesis about the kind of error and checking it directly
  • Recognize the common places a training pipeline breaks
  • Build a minimal reproducible example
  • Ask for help effectively with a minimal repro, the full traceback, and your environment
  • Read time: about 11 minutes
  • Practice time: about 10 minutes (a diagnose-the-error exercise plus flashcards; no required coding)
  • Difficulty: standard (no math or heavy code; the challenge is building a calm, systematic habit)