mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-04-27 18:29:08 +08:00
[misc] code lint (#10439)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -79,7 +79,7 @@ class Template:
|
||||
messages: list[dict[str, str]],
|
||||
system: Optional[str] = None,
|
||||
tools: Optional[str] = None,
|
||||
discarding_history_cot: bool = False, # only effect reasoning template
|
||||
discarding_history_cot: bool = False, # only effect reasoning template
|
||||
) -> list[tuple[list[int], list[int]]]:
|
||||
r"""Return multiple pairs of token ids representing prompts and responses respectively."""
|
||||
encoded_messages = self._encode(tokenizer, messages, system, tools)
|
||||
@@ -1018,15 +1018,17 @@ register_template(
|
||||
name="gemma4",
|
||||
format_user=StringFormatter(slots=["<|turn>user\n{{content}}<turn|>\n<|turn>model\n"]),
|
||||
format_assistant=StringFormatter(slots=["{{content}}<turn|>\n"]),
|
||||
format_system=StringFormatter(slots=["<|turn>system\n<|think|>{{content}}<turn|>\n"]), # default thought singal contained
|
||||
format_system=StringFormatter(
|
||||
slots=["<|turn>system\n<|think|>{{content}}<turn|>\n"]
|
||||
), # default thought singal contained
|
||||
format_observation=StringFormatter(
|
||||
slots=["<|turn>tool\n{{content}}<turn|>\n<|turn>model\n"]
|
||||
), # seem not consistent with the chattemplate
|
||||
), # seem not consistent with the chattemplate
|
||||
format_tools=ToolFormatter(tool_format="gemma4"),
|
||||
format_function=FunctionFormatter(slots=["<|tool>{{content}}<tool|>"], tool_format="gemma4"),
|
||||
format_prefix=EmptyFormatter(slots=[{"bos_token"}]),
|
||||
stop_words=["<turn|>"],
|
||||
default_system="You are a helpful assistant.", # important for thinking
|
||||
default_system="You are a helpful assistant.", # important for thinking
|
||||
thought_words=("<|channel>thought\n", "<channel|>"),
|
||||
replace_eos=True,
|
||||
mm_plugin=get_mm_plugin(
|
||||
@@ -1042,15 +1044,15 @@ register_template(
|
||||
name="gemma4n",
|
||||
format_user=StringFormatter(slots=["<|turn>user\n{{content}}<turn|>\n<|turn>model\n"]),
|
||||
format_assistant=StringFormatter(slots=["{{content}}<turn|>\n"]),
|
||||
format_system=StringFormatter(slots=["<|turn>system\n<|think|>{{content}}<turn|>\n"]), # default thought singal contained
|
||||
format_observation=StringFormatter(
|
||||
slots=["<|turn>tool\n{{content}}<turn|>\n<|turn>model\n"]
|
||||
),
|
||||
format_system=StringFormatter(
|
||||
slots=["<|turn>system\n<|think|>{{content}}<turn|>\n"]
|
||||
), # default thought singal contained
|
||||
format_observation=StringFormatter(slots=["<|turn>tool\n{{content}}<turn|>\n<|turn>model\n"]),
|
||||
format_tools=ToolFormatter(tool_format="gemma4"),
|
||||
format_function=FunctionFormatter(slots=["<|tool>{{content}}<tool|>"], tool_format="gemma4"),
|
||||
format_prefix=EmptyFormatter(slots=[{"bos_token"}]),
|
||||
stop_words=["<turn|>"],
|
||||
default_system="You are a helpful assistant.", # important for thinking
|
||||
default_system="You are a helpful assistant.", # important for thinking
|
||||
thought_words=("<|channel>thought\n", "<channel|>"),
|
||||
replace_eos=True,
|
||||
mm_plugin=get_mm_plugin(
|
||||
@@ -2356,4 +2358,3 @@ register_template(
|
||||
efficient_eos=True,
|
||||
template_class=Glm47ReasoningTemplate,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user