mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-30 02:53:41 +08:00
Increase hf max_length
This commit is contained in:
parent
66e1c0f050
commit
511f572b6c
@ -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))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user