From 6590983bf05aa05fe61a9360f5d50360ad84980f Mon Sep 17 00:00:00 2001 From: chuyuanpeng Date: Wed, 10 Jan 2024 17:18:24 +0800 Subject: [PATCH] Fix the position of add_generation_prompt --- Evaluation/HumanEval/eval_instruct.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Evaluation/HumanEval/eval_instruct.py b/Evaluation/HumanEval/eval_instruct.py index a85aa8c..7ea317e 100644 --- a/Evaluation/HumanEval/eval_instruct.py +++ b/Evaluation/HumanEval/eval_instruct.py @@ -23,7 +23,8 @@ def generate_one(example, lang, tokenizer, model): prompt = build_deepseekcoder_instruction(languge_settings[lang]['full_name'], example['prompt']) inputs = tokenizer.apply_chat_template( [{'role': 'user', 'content': prompt }], - return_tensors="pt" + return_tensors="pt", + add_generation_prompt=True ).to(model.device) stop_id = tokenizer.convert_tokens_to_ids("<|EOT|>") @@ -39,7 +40,7 @@ def generate_one(example, lang, tokenizer, model): eos_token_id=stop_id ) - output = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True, add_generation_prompt=True) + output = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True) example['output'] = output return extract_generation_code(example, lang_code=lang)