KublaiKhan1:

inputs = tokenizer([text], max_length=1024, return_tensors='pt')
[...]
# T5 uses a max_length of 512 so we cut the article to 512 tokens.
inputs = tokenizer.encode(abstract, return_tensors="pt", max_length=512)



You are using a different tokenization for both examples, and in particular, the max_length is different.  Maybe that’s the reason?