Implemented the tool_formatter and tool_extractor for glm4 tool_format

This commit is contained in:
mMrBun
2024-06-09 18:16:15 +08:00
parent 8bf9da659c
commit cb1cbcb293
2 changed files with 43 additions and 2 deletions

View File

@@ -662,9 +662,10 @@ _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_system=StringFormatter(slots=["[gMASK]<sop><|system|>\n{{content}}"]),
format_function=FunctionFormatter(slots=["{{name}}\n{{arguments}}"]),
format_observation=StringFormatter(slots=["<|observation|>\n{{content}}<|assistant|>"]),
format_tools=ToolFormatter(tool_format="glm4"),
stop_words=["<|user|>", "<|observation|>"],
efficient_eos=True,
force_system=True,