fix internlm2 template
This commit is contained in:
parent
c550987a72
commit
a9c18255aa
|
@ -37,9 +37,9 @@ class ChatModel:
|
||||||
tools: Optional[str] = None,
|
tools: Optional[str] = None,
|
||||||
**input_kwargs,
|
**input_kwargs,
|
||||||
) -> Tuple[Dict[str, Any], int]:
|
) -> Tuple[Dict[str, Any], int]:
|
||||||
messages += [{"role": "assistant", "content": ""}]
|
new_messages = messages + [{"role": "assistant", "content": ""}]
|
||||||
prompt, _ = self.template.encode_oneturn(
|
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)
|
prompt_length = len(prompt)
|
||||||
input_ids = torch.tensor([prompt], device=self.model.device)
|
input_ids = torch.tensor([prompt], device=self.model.device)
|
||||||
|
|
|
@ -416,7 +416,7 @@ register_template(
|
||||||
"by the user such as English and 中文."
|
"by the user such as English and 中文."
|
||||||
),
|
),
|
||||||
stop_words=["<|im_end|>"],
|
stop_words=["<|im_end|>"],
|
||||||
replace_eos=True,
|
efficient_eos=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue