mirror of
https://github.com/deepseek-ai/DeepSeek-Coder
synced 2024-12-04 18:14:44 +00:00
fix add_generation_prompt in latest version
This commit is contained in:
parent
d3bb741e25
commit
c160d96860
@ -39,7 +39,7 @@ def generate_one(example, lang, tokenizer, model):
|
|||||||
eos_token_id=stop_id
|
eos_token_id=stop_id
|
||||||
)
|
)
|
||||||
|
|
||||||
output = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
|
output = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True, add_generation_prompt=True)
|
||||||
example['output'] = output
|
example['output'] = output
|
||||||
|
|
||||||
return extract_generation_code(example, lang_code=lang)
|
return extract_generation_code(example, lang_code=lang)
|
||||||
|
@ -66,7 +66,7 @@ def generate_one(example, tokenizer, model):
|
|||||||
prompt = example['prompt']
|
prompt = example['prompt']
|
||||||
inputs = tokenizer.apply_chat_template(
|
inputs = tokenizer.apply_chat_template(
|
||||||
[{'role': 'user', 'content': prompt }],
|
[{'role': 'user', 'content': prompt }],
|
||||||
return_tensors="pt"
|
return_tensors="pt", add_generation_prompt=True
|
||||||
).to(model.device)
|
).to(model.device)
|
||||||
|
|
||||||
stop_id = tokenizer.convert_tokens_to_ids("<|EOT|>")
|
stop_id = tokenizer.convert_tokens_to_ids("<|EOT|>")
|
||||||
|
Loading…
Reference in New Issue
Block a user