Hugging Face, End to EndLesson 10 of 75

Module 2 · Transformers, from characters to output

One line that hides five steps

In this lesson

  • 8 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 1 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

A little at a time

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

Step 1 of 8Free · no account needed
Lesson steps

The shortest thing that works

Python
from transformers import pipeline

clf = pipeline("sentiment-analysis")
print(clf("The delivery was late but the food was excellent."))
# [{'label': 'POSITIVE', 'score': 0.9993}]

Two lines, no GPU, no configuration. This works on a laptop and on the free tier of Colab, and it is the right place to start because it lets you check that your environment is sane before you take on anything harder.

It also prints a warning that almost everybody scrolls past:

No model was supplied, defaulted to distilbert-base-uncased-finetuned-sst-2-english

That sentence is doing a lot of work. You did not choose a model; the library chose one for you. It is a 67-million-parameter English-only classifier fine-tuned on movie reviews from 2013. It is fast and it is decent on product feedback. It will be wrong in ways you cannot predict on Hinglish, on sarcasm, on medical notes, and on anything longer than 512 tokens, which it silently truncates.

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) ‘One line that hides five steps’, in Hugging Face, End to End. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/hugging-face/your-first-pipeline (Accessed: 27 November 2026).