[model] support Seed-OSS (#8992)

Co-authored-by: Yaowei Zheng <hiyouga@buaa.edu.cn>
This commit is contained in:
Kingsley
2025-08-23 22:38:24 +08:00
committed by GitHub
parent c14a5fefee
commit 0ab0be9df2
3 changed files with 81 additions and 3 deletions

View File

@@ -156,7 +156,7 @@ class Template:
elif message["role"] == Role.OBSERVATION:
elements += self.format_observation.apply(content=message["content"])
elif message["role"] == Role.FUNCTION:
elements += self.format_function.apply(content=message["content"])
elements += self.format_function.apply(content=message["content"], thought_words=self.thought_words)
else:
raise NotImplementedError("Unexpected role: {}".format(message["role"]))
@@ -1855,6 +1855,22 @@ register_template(
)
#copied from seed_coder
register_template(
name="seed_oss",
format_user=StringFormatter(
slots=[{"bos_token"}, "user\n{{content}}", {"eos_token"}, {"bos_token"}, "assistant\n"]
),
format_system=StringFormatter(slots=[{"bos_token"}, "system\n{{content}}", {"eos_token"}]),
format_function=FunctionFormatter(
slots=[{"bos_token"}, "\n{{content}}", {"eos_token"}], tool_format="seed_oss"
),
format_tools=ToolFormatter(tool_format="seed_oss"),
template_class=ReasoningTemplate,
thought_words=("<seed:think>", "</seed:think>")
)
# copied from llama3 template
register_template(
name="skywork_o1",