From e1f379bb090390acb62d36b7037cd93950ed322b Mon Sep 17 00:00:00 2001 From: Xiaojian Ma Date: Sat, 19 Apr 2025 03:50:17 +0800 Subject: [PATCH] Fixing the example in generation strategy doc (#37598) Update generation_strategies.md The prompt text shown in the example does not match what is inside the generated output. As the generated output always include the prompt, the correct prompt should be "Hugging Face is an open-source company". --- docs/source/en/generation_strategies.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/en/generation_strategies.md b/docs/source/en/generation_strategies.md index 5c56fb0e04..55889f880b 100644 --- a/docs/source/en/generation_strategies.md +++ b/docs/source/en/generation_strategies.md @@ -31,7 +31,7 @@ import torch from transformers import AutoModelForCausalLM, AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf") -inputs = tokenizer("I look forward to", return_tensors="pt").to("cuda") +inputs = tokenizer("Hugging Face is an open-source company", return_tensors="pt").to("cuda") model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf", torch_dtype=torch.float16).to("cuda") # explicitly set to default length because Llama2 generation length is 4096