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
Conversation
…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
5aa3327 to
c71eaee
Compare
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The
question-answering,summarization, andtranslationpipelines 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:(and the equivalent for
summarizationandtranslation). 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-generationpipeline and a chat model — this PR rewrites all three sections to prompt an instruction-tuned model:text-generation) instead of extractive; the surrounding prose is updated to reflect this.text-generationwith a summarize prompt.text-generationwith a translate prompt.All example outputs were captured from a real run on
transformers==5.13.Notes / decision points for reviewers
HuggingFaceTB/SmolLM2-360M-Instructto stay consistent with theSmolLM2-360Mmodel already used earlier in this chapter and to keep it light enough for free Colab. The migration guide's own example usesQwen/Qwen3-4B-Instruct-2507, which produces higher-quality output at a heavier download/compute cost — happy to switch if you'd prefer that.AutoTokenizer+AutoModelForQuestionAnswering(the approach taken in docs(tasks): remove references to removed question-answering pipeline transformers#44787).chapters/en/chapter1/3.mdxis changed; the localized copies are left to the course's translation workflow.Refs #1197, #1211