{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreicfkidcu3ossovjckwzw37mgtgp5wbpp6pjcvjudin2uqkuai47zy",
"uri": "at://did:plc:pgryn3ephfd2xgft23qokfzt/app.bsky.feed.post/3mie4nbszsmy2"
},
"path": "/t/pipeline-tutorial-summarization-doesnt-work/174833#post_2",
"publishedAt": "2026-03-31T09:47:42.000Z",
"site": "https://discuss.huggingface.co",
"tags": [
"version incompatibility between Transformers v4 and v5"
],
"textContent": "Yeah. It’s real version incompatibility between Transformers v4 and v5.\n\nIf go with v5, try without pipeline:\n\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\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\nOr try another supported pipeline:\n\n\n from transformers import pipeline\n\n summarizer = pipeline(\"text-generation\", model=\"Qwen/Qwen3-4B-Instruct-2507\")\n\n messages = [\n {\n \"role\": \"user\",\n \"content\": \"Summarize the following text in 3 bullet points:\\n\\n\" + text\n }\n ]\n\n out = summarizer(messages, max_new_tokens=200)\n print(out[0][\"generated_text\"][-1][\"content\"])\n",
"title": "Pipeline tutorial, summarization doesn't work"
}