Yeah. It’s real version incompatibility between Transformers v4 and v5.
If go with v5, try without pipeline:
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
model_id = "google-t5/t5-small" # or your finetuned summarization checkpoint
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
inputs = tokenizer(
"summarize: " + text,
return_tensors="pt",
truncation=True
).input_ids
outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)
summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(summary)
Or try another supported pipeline:
from transformers import pipeline
summarizer = pipeline("text-generation", model="Qwen/Qwen3-4B-Instruct-2507")
messages = [
{
"role": "user",
"content": "Summarize the following text in 3 bullet points:\n\n" + text
}
]
out = summarizer(messages, max_new_tokens=200)
print(out[0]["generated_text"][-1]["content"])