[model] add GLM-4.1V (#8462)

This commit is contained in:
Kingsley
2025-06-30 01:09:41 +08:00
committed by GitHub
parent 4f0da0aec9
commit d17a672251
5 changed files with 172 additions and 1 deletions

View File

@@ -998,6 +998,24 @@ register_template(
)
# part copied from glm4 template
register_template(
name="glm4v",
format_user=StringFormatter(slots=["<|user|>\n{{content}}<|assistant|>"]),
format_assistant=StringFormatter(slots=["\n{{content}}"]),
format_system=StringFormatter(slots=["<|system|>\n{{content}}"]),
format_function=FunctionFormatter(slots=["{{content}}"], tool_format="glm4"),
format_observation=StringFormatter(slots=["<|observation|>\n{{content}}<|assistant|>"]),
format_tools=ToolFormatter(tool_format="glm4"),
format_prefix=EmptyFormatter(slots=["[gMASK]<sop>"]),
stop_words=["<|user|>", "<|observation|>"],
efficient_eos=True,
mm_plugin=get_mm_plugin(name="glm4v", image_token="<|image|>", video_token="<|video|>"),
template_class=ReasoningTemplate,
thought_words=("<think>", "</think>"),
)
# copied from glm4 template
register_template(
name="glmz1",