SuperbEmphasis commited on
Commit
86ea8e3
·
verified ·
1 Parent(s): 2115e65

Upload folder using huggingface_hub

Browse files
chat_template.jinja CHANGED
@@ -1,87 +1 @@
1
- {%- if messages[0]["role"] == "system" %}
2
- {%- set system_message = messages[0]["content"] %}
3
- {%- set loop_messages = messages[1:] %}
4
- {%- else %}
5
- {%- set loop_messages = messages %}
6
- {%- endif %}
7
- {%- if not tools is defined %}
8
- {%- set tools = none %}
9
- {%- endif %}
10
- {%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
11
-
12
- {#- This block checks for alternating user/assistant messages, skipping tool calling messages #}
13
- {%- set ns = namespace() %}
14
- {%- set ns.index = 0 %}
15
- {%- for message in loop_messages %}
16
- {%- if not (message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %}
17
- {%- if (message["role"] == "user") != (ns.index % 2 == 0) %}
18
- {{- raise_exception("After the optional system message, conversation roles must alternate user/assistant/user/assistant/...") }}
19
- {%- endif %}
20
- {%- set ns.index = ns.index + 1 %}
21
- {%- endif %}
22
- {%- endfor %}
23
-
24
- {{- bos_token }}
25
- {%- for message in loop_messages %}
26
- {%- if message["role"] == "user" %}
27
- {%- if tools is not none and (message == user_messages[-1]) %}
28
- {{- "[AVAILABLE_TOOLS][" }}
29
- {%- for tool in tools %}
30
- {%- set tool = tool.function %}
31
- {{- '{"type": "function", "function": {' }}
32
- {%- for key, val in tool.items() if key != "return" %}
33
- {%- if val is string %}
34
- {{- '"' + key + '": "' + val + '"' }}
35
- {%- else %}
36
- {{- '"' + key + '": ' + val|tojson }}
37
- {%- endif %}
38
- {%- if not loop.last %}
39
- {{- ", " }}
40
- {%- endif %}
41
- {%- endfor %}
42
- {{- "}}" }}
43
- {%- if not loop.last %}
44
- {{- ", " }}
45
- {%- else %}
46
- {{- "]" }}
47
- {%- endif %}
48
- {%- endfor %}
49
- {{- "[/AVAILABLE_TOOLS]" }}
50
- {%- endif %}
51
- {%- if loop.last and system_message is defined %}
52
- {{- "[INST]" + system_message + "\n\n" + message["content"] + "[/INST]" }}
53
- {%- else %}
54
- {{- "[INST]" + message["content"] + "[/INST]" }}
55
- {%- endif %}
56
- {%- elif (message.tool_calls is defined and message.tool_calls is not none) %}
57
- {{- "[TOOL_CALLS][" }}
58
- {%- for tool_call in message.tool_calls %}
59
- {%- set out = tool_call.function|tojson %}
60
- {{- out[:-1] }}
61
- {%- if not tool_call.id is defined or tool_call.id|length != 9 %}
62
- {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
63
- {%- endif %}
64
- {{- ', "id": "' + tool_call.id + '"}' }}
65
- {%- if not loop.last %}
66
- {{- ", " }}
67
- {%- else %}
68
- {{- "]" + eos_token }}
69
- {%- endif %}
70
- {%- endfor %}
71
- {%- elif message["role"] == "assistant" %}
72
- {{- message["content"] + eos_token}}
73
- {%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
74
- {%- if message.content is defined and message.content.content is defined %}
75
- {%- set content = message.content.content %}
76
- {%- else %}
77
- {%- set content = message.content %}
78
- {%- endif %}
79
- {{- '[TOOL_RESULTS]{"content": ' + content|string + ", " }}
80
- {%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}
81
- {{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
82
- {%- endif %}
83
- {{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
84
- {%- else %}
85
- {{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
86
- {%- endif %}
87
- {%- endfor %}
 
1
+ {{ bos_token }}{% if messages[0]['role'] == 'system' %}{% if messages[1]['role'] == 'user' %}{{ '[INST] ' + messages[0]['content'] + ' ' + messages[1]['content'] + ' [/INST]' }}{% set loop_messages = messages[2:] %}{% else %}{{ '[INST] ' + messages[0]['content'] + ' [/INST]' }}{% set loop_messages = messages[1:] %}{% endif %}{% else %}{% set loop_messages = messages %}{% endif %}{% for message in loop_messages %}{% if message['role'] == 'user' %}{{ '[INST] ' + message['content'] + ' [/INST]' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + eos_token }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
model-00001-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2e3cac8c47b9212402b6a31e5150d4d1b7d7a10e43b8e429027f3c6460ccb402
3
  size 4865522496
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6513d1bac6e6b3ba914ee63560531ddaf70dd79984749e02062f424247a2e5ad
3
  size 4865522496
model-00002-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5ace0551f87e85abf1bddc1bd42beb1455c74343cae7580e7fa1b1f7da96055c
3
  size 4907529424
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0504f56d039cc8c3b23c3ca9efe32192dd816481a8dbf36608b924dce9a4cc1c
3
  size 4907529424
model-00003-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d5748ad54c42b5270fda1227ed670b46f473bac9000be084b7786628658c91a0
3
  size 4907529456
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56faffc94d7c0fc22b8ff341b00f8d204ba934ee920d1ccde05252d10aec2aa3
3
  size 4907529456
model-00004-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:390dd3fbd84016e58c300e438e197aabf461c0d382b66d559c14ce535096aaf6
3
  size 4907529456
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6eecfdde3c7a8f5c32965b22ecb4941304e19264c5351f3b89765e7f817b1d79
3
  size 4907529456
model-00005-of-00005.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e43e35e11d356ee47bc5a907353f86a72c36897a9580716155158ec73e7fb382
3
  size 2726372064
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3daa785cd1bd44f41693481eee645d8c6375535d9ef95555f4b56227805cb808
3
  size 2726372064
special_tokens_map.json CHANGED
@@ -13,7 +13,13 @@
13
  "rstrip": false,
14
  "single_word": false
15
  },
16
- "pad_token": "<pad>",
 
 
 
 
 
 
17
  "unk_token": {
18
  "content": "<unk>",
19
  "lstrip": false,
 
13
  "rstrip": false,
14
  "single_word": false
15
  },
16
+ "pad_token": {
17
+ "content": "<pad>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
  "unk_token": {
24
  "content": "<unk>",
25
  "lstrip": false,