fix internlm2 template

This commit is contained in:
hiyouga 2024-01-20 23:33:50 +08:00
parent c550987a72
commit a9c18255aa
2 changed files with 3 additions and 3 deletions

View File

@ -37,9 +37,9 @@ class ChatModel:
tools: Optional[str] = None,
**input_kwargs,
) -> Tuple[Dict[str, Any], int]:
messages += [{"role": "assistant", "content": ""}]
new_messages = messages + [{"role": "assistant", "content": ""}]
prompt, _ = self.template.encode_oneturn(
tokenizer=self.tokenizer, messages=messages, system=system, tools=tools
tokenizer=self.tokenizer, messages=new_messages, system=system, tools=tools
)
prompt_length = len(prompt)
input_ids = torch.tensor([prompt], device=self.model.device)

View File

@ -416,7 +416,7 @@ register_template(
"by the user such as English and 中文."
),
stop_words=["<|im_end|>"],
replace_eos=True,
efficient_eos=True,
)