Increase hf max_length

This commit is contained in:
Juarez Bochi 2023-12-18 13:35:44 -05:00
parent 66e1c0f050
commit 511f572b6c
No known key found for this signature in database
GPG Key ID: 34CCBB77DC8BEBB6

View File

@ -27,7 +27,7 @@ def generate(t5_model: str):
tokenizer = AutoTokenizer.from_pretrained(t5_model) tokenizer = AutoTokenizer.from_pretrained(t5_model)
torch_model = T5ForConditionalGeneration.from_pretrained(t5_model) torch_model = T5ForConditionalGeneration.from_pretrained(t5_model)
torch_tokens = tokenizer(prompt, return_tensors="pt", padding=True).input_ids 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)) print(tokenizer.decode(outputs[0], skip_special_tokens=True))