From 511f572b6cbfe3c362ddd255d6e4daf9423e45d1 Mon Sep 17 00:00:00 2001 From: Juarez Bochi Date: Mon, 18 Dec 2023 13:35:44 -0500 Subject: [PATCH] Increase hf max_length --- t5/hf_t5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t5/hf_t5.py b/t5/hf_t5.py index b39f807c..ddd99610 100644 --- a/t5/hf_t5.py +++ b/t5/hf_t5.py @@ -27,7 +27,7 @@ def generate(t5_model: str): tokenizer = AutoTokenizer.from_pretrained(t5_model) torch_model = T5ForConditionalGeneration.from_pretrained(t5_model) torch_tokens = tokenizer(prompt, return_tensors="pt", padding=True).input_ids - outputs = torch_model.generate(torch_tokens) + outputs = torch_model.generate(torch_tokens, do_sample=False, max_length=512) print(tokenizer.decode(outputs[0], skip_special_tokens=True))