Hugging Face, End to EndLesson 18 of 75

Module 2 · Transformers, from characters to output

It loaded, it ran, the output is nonsense

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 9 of 9 in this chapter

This chapter’s goalTrace a piece of text from characters through a tokenizer to logits and back to text with the transformers library, and say which of the Auto class, the tokenizer, the padding side, the chat template or the generation config is at fault when a model loads without error and produces nonsense.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableWatch4:51
Full audiobookNot availableNot available
The order to check, not the order to guessInstruct?Is chat_templatesetTemplated?Not typed byhandSame repo?Tokenizer andweightsLeft padding?Only if batchedModel lastNine checksfirstEach step is under a minute and they are ordered by how often each is the cause. The model itself isthe tenth suspect, not the first, because fluent-but-wrong output is far more often a configurationmismatch than a bad checkpoint.
Each step is under a minute and they are ordered by how often each is the cause. The model itself is the tenth suspect, not the first, because fluent-but-wrong output is far more often a configuration mismatch than a bad checkpoint.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

The worst category of bug

No traceback. No warning you noticed. The model produced fluent, confident, wrong text, or a classifier returned labels that look plausible and are random. Everything downstream works perfectly on garbage.

This lesson is a checklist in order of how often each cause is the cause. Work down it rather than guessing; each step is under a minute.

1. Is it an instruct model?

Python
print("chat_template:", tok.chat_template is not None)

False on a model you are prompting conversationally means you have a base checkpoint. A base model continues text; asked “What is the capital of Bihar?” it may reply with three more quiz questions. Nothing is broken. Get the -Instruct variant.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Image Generation, in Practice exam.

Stuck on something?Ask Arjun, your AI tutor

How to cite: Addaly (2026) ‘It loaded, it ran, the output is nonsense’, in Hugging Face, End to End. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/hugging-face/loads-but-outputs-rubbish (Accessed: 29 November 2026).