Merge pull request #4173 from mMrBun/main

Implemented the tool_formatter and tool_extractor for glm4 and Qwen2 tool_format
This commit is contained in:
hoshi-hiyouga
2024-06-19 03:18:55 +08:00
committed by GitHub
3 changed files with 63 additions and 16 deletions

View File

@@ -676,9 +676,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,