support glm-4

Former-commit-id: a10f4718fbf3f3c89dc7eb31cb8e1a46ca6adda5
This commit is contained in:
hiyouga
2024-06-05 15:16:38 +08:00
parent 2ac2cde03e
commit 7528bc1bc0
4 changed files with 56 additions and 17 deletions

View File

@@ -658,6 +658,19 @@ _register_template(
)
_register_template(
name="glm4",
format_user=StringFormatter(slots=["<|user|>\n{{content}}<|assistant|>"]),
format_assistant=StringFormatter(slots=["\n{{content}}"]),
format_system=StringFormatter(slots=["[gMASK]<sop>{{content}}"]),
format_function=FunctionFormatter(slots=["{{name}}\n{{arguments}}"]),
format_observation=StringFormatter(slots=["<|observation|>\n{{content}}<|assistant|>"]),
stop_words=["<|user|>", "<|observation|>"],
efficient_eos=True,
force_system=True,
)
_register_template(
name="intern",
format_user=StringFormatter(slots=["<|User|>:{{content}}", {"token": "<eoh>"}, "\n<|Bot|>:"]),