Implemented the tool_formatter and tool_extractor for glm4 tool_format

Former-commit-id: db7fa4490ea7f6966418d2879c895cbc1763b16d
This commit is contained in:
mMrBun
2024-06-09 18:16:15 +08:00
parent f45e81e186
commit 8db8ed5a41
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,