{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreifqlet3fuamefs54rvj7jwpgceo42lxsjctlcepjlfvnngf5kip4a",
    "uri": "at://did:plc:pgryn3ephfd2xgft23qokfzt/app.bsky.feed.post/3mie4mpwj4ih2"
  },
  "path": "/t/pipeline-tutorial-summarization-doesnt-work/174833#post_4",
  "publishedAt": "2026-03-31T09:56:02.000Z",
  "site": "https://discuss.huggingface.co",
  "textContent": "This worked in Colab in my own notebook.\n\n\n    # Fixed code from this tutorial:\n    # https://huggingface.co/learn/llm-course/chapter1/3\n\n    from transformers import AutoTokenizer, AutoModelForSeq2SeqLM\n\n    model_id = \"google-t5/t5-small\"   # or your finetuned summarization checkpoint\n    tokenizer = AutoTokenizer.from_pretrained(model_id)\n    model = AutoModelForSeq2SeqLM.from_pretrained(model_id)\n    text =     \"\"\"\n        America has changed dramatically during recent years. Not only has the number of\n        graduates in traditional engineering disciplines such as mechanical, civil,\n        electrical, chemical, and aeronautical engineering declined, but in most of\n        the premier American universities engineering curricula now concentrate on\n        and encourage largely the study of engineering science. As a result, there\n        are declining offerings in engineering subjects dealing with infrastructure,\n        the environment, and related issues, and greater concentration on high\n        technology subjects, largely supporting increasingly complex scientific\n        developments. While the latter is important, it should not be at the expense\n        of more traditional engineering.\n\n        Rapidly developing economies such as China and India, as well as other\n        industrial countries in Europe and Asia, continue to encourage and advance\n        the teaching of engineering. Both China and India, respectively, graduate\n        six and eight times as many traditional engineers as does the United States.\n        Other industrial countries at minimum maintain their output, while America\n        suffers an increasingly serious decline in the number of engineering graduates\n        and a lack of well-educated engineers.\n    \"\"\"\n    inputs = tokenizer(\n        \"summarize: \" + text,\n        return_tensors=\"pt\",\n        truncation=True\n    ).input_ids\n\n    outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)\n    summary = tokenizer.decode(outputs[0], skip_special_tokens=True)\n    print(summary)\n\n\n\nThe program did have some warnings and did not wrap the output text “summary” but that’s fine.",
  "title": "Pipeline tutorial, summarization doesn't work"
}