chat : Align Laguna-S-2.1 chat template to huggingface (#26232)
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
{#- Iteration on laguna_glm_thinking_v8/chat_template.jinja -#}
|
{#- Iteration on laguna_glm_thinking_v8/chat_template.jinja -#}
|
||||||
{#- No formatting instructions -#}
|
{#- No formatting instructions -#}
|
||||||
{{- "〈|EOS|〉" -}}
|
{{- "〈|EOS|〉" -}}
|
||||||
{%- set enable_thinking = enable_thinking | default(false) -%}
|
{%- set enable_thinking = enable_thinking | default(true) -%}
|
||||||
{%- set add_generation_prompt = add_generation_prompt | default(false) -%}
|
{%- set add_generation_prompt = add_generation_prompt | default(false) -%}
|
||||||
|
{%- set preserve_thinking = preserve_thinking | default(false) -%}
|
||||||
|
|
||||||
{#- ───── header (system message) ───── -#}
|
{#- ───── header (system message) ───── -#}
|
||||||
{#- A caller-supplied system message with empty content opts out of the default below, producing no <system> block — used to train without a system message. -#}
|
{#- A caller-supplied system message with empty content opts out of the default below, producing no <system> block — used to train without a system message. -#}
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
{%- set reasoning_content = message.reasoning_content -%}
|
{%- set reasoning_content = message.reasoning_content -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{#- Display reasoning content for all messages if enable_thinking -#}
|
{#- Display reasoning content for all messages if enable_thinking -#}
|
||||||
{%- if enable_thinking -%}
|
{%- if enable_thinking or preserve_thinking -%}
|
||||||
{{- '<think>' + reasoning_content + '</think>' -}}
|
{{- '<think>' + reasoning_content + '</think>' -}}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{- '</think>' -}}
|
{{- '</think>' -}}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ static void test_laguna_tool_format(testing & t);
|
|||||||
static void test_laguna_s_analysis(testing & t);
|
static void test_laguna_s_analysis(testing & t);
|
||||||
static void test_laguna_s_reasoning_detection(testing & t);
|
static void test_laguna_s_reasoning_detection(testing & t);
|
||||||
static void test_laguna_s_tool_format(testing & t);
|
static void test_laguna_s_tool_format(testing & t);
|
||||||
|
static void test_laguna_s_preserve_reasoning(testing & t);
|
||||||
static void test_laguna_xs2_analysis(testing & t);
|
static void test_laguna_xs2_analysis(testing & t);
|
||||||
static void test_laguna_xs2_reasoning_detection(testing & t);
|
static void test_laguna_xs2_reasoning_detection(testing & t);
|
||||||
static void test_laguna_xs2_tool_format(testing & t);
|
static void test_laguna_xs2_tool_format(testing & t);
|
||||||
@@ -1451,9 +1452,14 @@ static void test_laguna_s_tool_format(testing & t) {
|
|||||||
analysis.analyze_template(tmpl);
|
analysis.analyze_template(tmpl);
|
||||||
t.assert_equal("Laguna-S(v8) arg_value_suffix should be '</arg_value>'", "</arg_value>", analysis.tools.arguments.value_suffix);
|
t.assert_equal("Laguna-S(v8) arg_value_suffix should be '</arg_value>'", "</arg_value>", analysis.tools.arguments.value_suffix);
|
||||||
}
|
}
|
||||||
|
static void test_laguna_s_preserve_reasoning(testing & t) {
|
||||||
|
common_chat_template tmpl = load_laguna_s_template(t);
|
||||||
|
t.assert_true("Laguna-S(v8) supports preserving reasoning", tmpl.original_caps().supports_preserve_reasoning);
|
||||||
|
}
|
||||||
static void test_laguna_s_analysis(testing & t) {
|
static void test_laguna_s_analysis(testing & t) {
|
||||||
t.test("Laguna-S(v8) reasoning detection", test_laguna_s_reasoning_detection);
|
t.test("Laguna-S(v8) reasoning detection", test_laguna_s_reasoning_detection);
|
||||||
t.test("Laguna-S(v8) tool format", test_laguna_s_tool_format);
|
t.test("Laguna-S(v8) tool format", test_laguna_s_tool_format);
|
||||||
|
t.test("Laguna-S(v8) preserve reasoning", test_laguna_s_preserve_reasoning);
|
||||||
}
|
}
|
||||||
|
|
||||||
static common_chat_template load_laguna_xs2_template(testing & t) {
|
static common_chat_template load_laguna_xs2_template(testing & t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user