cyente commited on
Commit
61868e4
·
verified ·
1 Parent(s): 1f6f99b

Delete chat_template.jinja

Browse files

https://huggingface.co/Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8/discussions/5#68a4c84a209074df353a8b76

del the chat template here to avoid confusing

Files changed (1) hide show
  1. chat_template.jinja +0 -131
chat_template.jinja DELETED
@@ -1,131 +0,0 @@
1
- {% macro render_item_list(item_list, tag_name='required') %}
2
- {%- if item_list is defined and item_list is iterable and item_list | length > 0 %}
3
- {%- if tag_name %}{{- '\n<' ~ tag_name ~ '>' -}}{% endif %}
4
- {{- '[' }}
5
- {%- for item in item_list -%}
6
- {%- if loop.index > 1 %}{{- ", "}}{% endif -%}
7
- {%- if item is string -%}
8
- {{ "`" ~ item ~ "`" }}
9
- {%- else -%}
10
- {{ item }}
11
- {%- endif -%}
12
- {%- endfor -%}
13
- {{- ']' }}
14
- {%- if tag_name %}{{- '</' ~ tag_name ~ '>' -}}{% endif %}
15
- {%- endif %}
16
- {% endmacro %}
17
-
18
- {%- if messages[0]["role"] == "system" %}
19
- {%- set system_message = messages[0]["content"] %}
20
- {%- set loop_messages = messages[1:] %}
21
- {%- else %}
22
- {%- set loop_messages = messages %}
23
- {%- endif %}
24
-
25
- {%- if not tools is defined %}
26
- {%- set tools = [] %}
27
- {%- endif %}
28
-
29
- {%- if system_message is defined %}
30
- {{- "<|im_start|>system\n" + system_message }}
31
- {%- else %}
32
- {%- if tools is iterable and tools | length > 0 %}
33
- {{- "<|im_start|>system\nYou are Qwen, a helpful AI assistant that can interact with a computer to solve tasks." }}
34
- {%- endif %}
35
- {%- endif %}
36
- {%- if tools is iterable and tools | length > 0 %}
37
- {{- "\n\nYou have access to the following functions:\n\n" }}
38
- {{- "<tools>" }}
39
- {%- for tool in tools %}
40
- {%- if tool.function is defined %}
41
- {%- set tool = tool.function %}
42
- {%- endif %}
43
- {{- "\n<function>\n<name>" ~ tool.name ~ "</name>" }}
44
- {{- '\n<description>' ~ (tool.description | trim) ~ '</description>' }}
45
- {{- '\n<parameters>' }}
46
- {%- for param_name, param_fields in tool.parameters.properties|items %}
47
- {{- '\n<parameter>' }}
48
- {{- '\n<name>' ~ param_name ~ '</name>' }}
49
- {%- if param_fields.type is defined %}
50
- {{- '\n<type>' ~ (param_fields.type | string) ~ '</type>' }}
51
- {%- endif %}
52
- {%- if param_fields.description is defined %}
53
- {{- '\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}
54
- {%- endif %}
55
- {{- render_item_list(param_fields.enum, 'enum') }}
56
- {%- set handled_keys = ['type', 'description', 'enum', 'required'] %}
57
- {%- for json_key in param_fields.keys() | reject("in", handled_keys) %}
58
- {%- set normed_json_key = json_key | replace("-", "_") | replace(" ", "_") | replace("$", "") %}
59
- {%- if param_fields[json_key] is mapping %}
60
- {{- '\n<' ~ normed_json_key ~ '>' ~ (param_fields[json_key] | tojson | safe) ~ '</' ~ normed_json_key ~ '>' }}
61
- {%- else %}
62
- {{-'\n<' ~ normed_json_key ~ '>' ~ (param_fields[json_key] | string) ~ '</' ~ normed_json_key ~ '>' }}
63
- {%- endif %}
64
- {%- endfor %}
65
- {{- render_item_list(param_fields.required, 'required') }}
66
- {{- '\n</parameter>' }}
67
- {%- endfor %}
68
- {{- render_item_list(tool.parameters.required, 'required') }}
69
- {{- '\n</parameters>' }}
70
- {%- if tool.return is defined %}
71
- {%- if tool.return is mapping %}
72
- {{- '\n<return>' ~ (tool.return | tojson | safe) ~ '</return>' }}
73
- {%- else %}
74
- {{- '\n<return>' ~ (tool.return | string) ~ '</return>' }}
75
- {%- endif %}
76
- {%- endif %}
77
- {{- '\n</function>' }}
78
- {%- endfor %}
79
- {{- "\n</tools>" }}
80
- {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
81
- {%- endif %}
82
- {%- if system_message is defined %}
83
- {{- '<|im_end|>\n' }}
84
- {%- else %}
85
- {%- if tools is iterable and tools | length > 0 %}
86
- {{- '<|im_end|>\n' }}
87
- {%- endif %}
88
- {%- endif %}
89
- {%- for message in loop_messages %}
90
- {%- if message.role == "assistant" and message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}
91
- {{- '<|im_start|>' + message.role }}
92
- {%- if message.content is defined and message.content is string and message.content | trim | length > 0 %}
93
- {{- '\n' + message.content | trim + '\n' }}
94
- {%- endif %}
95
- {%- for tool_call in message.tool_calls %}
96
- {%- if tool_call.function is defined %}
97
- {%- set tool_call = tool_call.function %}
98
- {%- endif %}
99
- {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
100
- {%- if tool_call.arguments is defined %}
101
- {%- for args_name, args_value in tool_call.arguments|items %}
102
- {{- '<parameter=' + args_name + '>\n' }}
103
- {%- set args_value = args_value if args_value is string else args_value | string %}
104
- {{- args_value }}
105
- {{- '\n</parameter>\n' }}
106
- {%- endfor %}
107
- {%- endif %}
108
- {{- '</function>\n</tool_call>' }}
109
- {%- endfor %}
110
- {{- '<|im_end|>\n' }}
111
- {%- elif message.role == "user" or message.role == "system" or message.role == "assistant" %}
112
- {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
113
- {%- elif message.role == "tool" %}
114
- {%- if loop.previtem and loop.previtem.role != "tool" %}
115
- {{- '<|im_start|>user\n' }}
116
- {%- endif %}
117
- {{- '<tool_response>\n' }}
118
- {{- message.content }}
119
- {{- '\n</tool_response>\n' }}
120
- {%- if not loop.last and loop.nextitem.role != "tool" %}
121
- {{- '<|im_end|>\n' }}
122
- {%- elif loop.last %}
123
- {{- '<|im_end|>\n' }}
124
- {%- endif %}
125
- {%- else %}
126
- {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>\n' }}
127
- {%- endif %}
128
- {%- endfor %}
129
- {%- if add_generation_prompt %}
130
- {{- '<|im_start|>assistant\n' }}
131
- {%- endif %}