Skip to content

Fix Chapter 1.3: migrate removed question-answering/summarization/translation pipelines to text-generation (Transformers v5)#1277

Open
critesjosh wants to merge 1 commit into
huggingface:mainfrom
critesjosh:fix/chapter1-v5-pipeline-migration
Open

Fix Chapter 1.3: migrate removed question-answering/summarization/translation pipelines to text-generation (Transformers v5)#1277
critesjosh wants to merge 1 commit into
huggingface:mainfrom
critesjosh:fix/chapter1-v5-pipeline-migration

Conversation

@critesjosh

Copy link
Copy Markdown

What does this PR do?

The question-answering, summarization, and translation pipelines were removed in Transformers v5.3. As a result, three code samples in Chapter 1 §3 ("Transformers, what can they do?") now fail on current Transformers with:

KeyError: "Unknown task question-answering, available tasks are [...]"

(and the equivalent for summarization and translation). This affects both the course page and its auto-generated Colab notebook.

Fix

Following the official v5 migration guide — which recommends replacing these task pipelines with the text-generation pipeline and a chat model — this PR rewrites all three sections to prompt an instruction-tuned model:

  • Question answering → now generative (via text-generation) instead of extractive; the surrounding prose is updated to reflect this.
  • Summarizationtext-generation with a summarize prompt.
  • Translationtext-generation with a translate prompt.
  • Added a short note in the pipelines overview explaining that these tasks no longer have dedicated pipelines as of v5.

All example outputs were captured from a real run on transformers==5.13.

Notes / decision points for reviewers

  • Model choice: I used HuggingFaceTB/SmolLM2-360M-Instruct to stay consistent with the SmolLM2-360M model already used earlier in this chapter and to keep it light enough for free Colab. The migration guide's own example uses Qwen/Qwen3-4B-Instruct-2507, which produces higher-quality output at a heavier download/compute cost — happy to switch if you'd prefer that.
  • Extractive vs. generative QA: I moved QA to the generative approach for consistency with the other two tasks and with the migration guide. If you'd rather keep it extractive, it can instead use AutoTokenizer + AutoModelForQuestionAnswering (the approach taken in docs(tasks): remove references to removed question-answering pipeline transformers#44787).
  • Scope: only the English source chapters/en/chapter1/3.mdx is changed; the localized copies are left to the course's translation workflow.

Refs #1197, #1211

…es to text-generation

The question-answering, summarization, and translation pipelines were
removed in Transformers v5.3, so three code samples in chapter 1.3 raise
KeyError: Unknown task ... on current Transformers.

Following the official v5 migration guide, these tasks now use the
text-generation pipeline with an instruction-tuned chat model
(HuggingFaceTB/SmolLM2-360M-Instruct, consistent with the SmolLM2-360M
model already used in this chapter). Question answering becomes
generative rather than extractive. Example outputs captured from a real
run on transformers 5.13.

Refs: huggingface#1197, huggingface#1211
@critesjosh critesjosh force-pushed the fix/chapter1-v5-pipeline-migration branch from 5aa3327 to c71eaee Compare July 15, 2026 00:49
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants