minpeter commited on
Commit
36b7827
·
verified ·
1 Parent(s): e9d02db

Training in progress, step 380

Browse files
Files changed (2) hide show
  1. adapter_model.safetensors +1 -1
  2. chat_template.jinja +3 -79
adapter_model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5f6efabbe057aa223925cfe0a8524c7a8281d69f5cf427ccc263126874b24a2a
3
  size 22573704
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8cd3711fc9a1c7586a2db62679585d2aa09c666fd020dd14eec5bd451af3502
3
  size 22573704
chat_template.jinja CHANGED
@@ -1,81 +1,5 @@
1
- {%- macro json_to_python_type(json_spec) -%}
2
- {%- set basic_type_map = {"string": "str", "number": "float", "integer": "int", "boolean": "bool"} -%}
3
- {%- if basic_type_map[json_spec.type] is defined -%}{{- basic_type_map[json_spec.type] -}}
4
- {%- elif json_spec.type == "array" -%}{{- "list[" + json_to_python_type(json_spec.items) + "]" -}}
5
- {%- elif json_spec.type == "object" -%}{{- "dict[str, " + json_to_python_type(json_spec.additionalProperties) + "]" if json_spec.additionalProperties is defined else "dict" -}}
6
- {%- elif json_spec.type is iterable -%}{{- "Union[" + (json_spec.type|map('regex_replace', '^(.*)$', 'json_to_python_type({"type": "\\1"})')|join(', ')) + "]" -}}
7
- {%- else -%}{{- "Any" -}}
8
- {%- endif -%}
9
- {%- endmacro -%}
10
 
11
- {%- set add_generation_prompt = add_generation_prompt if add_generation_prompt is defined else false -%}
12
- {{- bos_token -}}
13
 
14
- {%- if tools is defined and tools|length > 0 -%}
15
- {{- '<|start_header_id|>system<|end_header_id|>\n\nYou are a function calling AI model. You are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. Don\'t make assumptions about what values to plug into functions. Here are the available tools: <tools> ' -}}
16
- {%- for tool in tools -%}
17
- {%- set t = tool.function if tool.function is defined else tool -%}
18
- {{- '{"type": "function", "function": {"name": "' + t.name + '", "description": "' + t.name + '(' + (t.parameters.properties|items|map('join', ': ')|map('regex_replace', '^([^:]+): (.*)
19
-
20
- {%- for message in messages -%}
21
- {%- if message.role == "user" or (message.role == "assistant" and message.tool_calls is not defined) -%}
22
- {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n\n' + message.content + '<|eot_id|>' -}}
23
- {%- elif message.role == "assistant" -%}
24
- {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
25
- {%- for tool_call in message.tool_calls -%}
26
- {%- set tc = tool_call.function if tool_call.function is defined else tool_call -%}
27
- {{- '<tool_call>\n{"name": "' + tc.name + '", "arguments": ' + (tc.arguments if tc.arguments is string else tc.arguments|tojson) + '}\n</tool_call>' -}}
28
- {%- endfor -%}
29
- {{- '<|eot_id|>' -}}
30
- {%- elif message.role == "tool" -%}
31
- {%- if loop.previtem and loop.previtem.role != "tool" -%}{{- '<|start_header_id|>tool<|end_header_id|>\n\n' -}}{%- endif -%}
32
- {{- '<tool_response>\n' + message.content + ('\n</tool_response>' + ('\n' if not loop.last else '') + ('<|eot_id|>' if loop.last or loop.nextitem.role != "tool" else '')) -}}
33
- {%- elif message.role == "system" and not (tools is defined and tools|length > 0) -%}
34
- {{- '<|start_header_id|>system<|end_header_id|>\n\n' + message.content + '<|eot_id|>' -}}
35
- {%- endif -%}
36
- {%- endfor -%}
37
-
38
- {%- if add_generation_prompt -%}{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}{%- endif -%}, '\\1: ' + 'json_to_python_type(\\2)')|join(', ')) + ')' + (' -> ' + json_to_python_type(t.return) if t.return is defined else '') + ' - ' + t.description + '\n\n Args:\n' + (t.parameters.properties|items|map('join', '): ')|map('regex_replace', '^([^)]+\\)): (.*)
39
-
40
- {%- for message in messages -%}
41
- {%- if message.role in ["user", "system"] or (message.role == "assistant" and message.tool_calls is not defined) -%}
42
- {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n\n' + message.content + '<|eot_id|>' -}}
43
- {%- elif message.role == "assistant" -%}
44
- {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
45
- {%- for tool_call in message.tool_calls -%}
46
- {%- set tc = tool_call.function if tool_call.function is defined else tool_call -%}
47
- {{- '<tool_call>\n{"name": "' + tc.name + '", "arguments": ' + (tc.arguments if tc.arguments is string else tc.arguments|tojson) + '}\n</tool_call>' -}}
48
- {%- endfor -%}
49
- {{- '<|eot_id|>' -}}
50
- {%- elif message.role == "tool" -%}
51
- {%- if loop.previtem and loop.previtem.role != "tool" -%}{{- '<|start_header_id|>tool<|end_header_id|>\n\n' -}}{%- endif -%}
52
- {{- '<tool_response>\n' + message.content + ('\n</tool_response>' + ('\n' if not loop.last else '') + ('<|eot_id|>' if loop.last or loop.nextitem.role != "tool" else '')) -}}
53
- {%- endif -%}
54
- {%- endfor -%}
55
-
56
- {%- if add_generation_prompt -%}{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}{%- endif -%}, ' \\1: \\2')|join('')) + ('\n Returns:\n ' + t.return.description if t.return is defined and t.return.description is defined else '') + '", "parameters": ' + (t.parameters|tojson if t.parameters.properties|length > 0 else '{}') + '}' + ('\n' if not loop.last else '') -}}
57
- {%- endfor -%}
58
- {{- ' </tools>Use the following pydantic model json schema for each tool call you will make: {"properties": {"name": {"title": "Name", "type": "string"}, "arguments": {"title": "Arguments", "type": "object"}}, "required": ["name", "arguments"], "title": "FunctionCall", "type": "object"}\nFor each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:\n<tool_call>\n{"name": <function-name>, "arguments": <args-dict>}\n</tool_call>' -}}
59
- {%- for message in messages -%}
60
- {%- if message.role == "system" -%}{{- '\n\n' + message.content -}}{%- endif -%}
61
- {%- endfor -%}
62
- {{- '<|eot_id|>' -}}
63
- {%- endif -%}
64
-
65
- {%- for message in messages -%}
66
- {%- if message.role in ["user", "system"] or (message.role == "assistant" and message.tool_calls is not defined) -%}
67
- {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n\n' + message.content + '<|eot_id|>' -}}
68
- {%- elif message.role == "assistant" -%}
69
- {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}
70
- {%- for tool_call in message.tool_calls -%}
71
- {%- set tc = tool_call.function if tool_call.function is defined else tool_call -%}
72
- {{- '<tool_call>\n{"name": "' + tc.name + '", "arguments": ' + (tc.arguments if tc.arguments is string else tc.arguments|tojson) + '}\n</tool_call>' -}}
73
- {%- endfor -%}
74
- {{- '<|eot_id|>' -}}
75
- {%- elif message.role == "tool" -%}
76
- {%- if loop.previtem and loop.previtem.role != "tool" -%}{{- '<|start_header_id|>tool<|end_header_id|>\n\n' -}}{%- endif -%}
77
- {{- '<tool_response>\n' + message.content + ('\n</tool_response>' + ('\n' if not loop.last else '') + ('<|eot_id|>' if loop.last or loop.nextitem.role != "tool" else '')) -}}
78
- {%- endif -%}
79
- {%- endfor -%}
80
-
81
- {%- if add_generation_prompt -%}{{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}}{%- endif -%}
 
1
+ {% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>
 
 
 
 
 
 
 
 
2
 
3
+ '+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{% if add_generation_prompt %}{{ '<|start_header_id|>assistant<|end_header_id|>
 
4
 
5
+ ' }}{% endif %}