functions inuser messages ignored
Browse files- fix_tokens.py +1 -1
- tokenizer.json +4 -4
- tokenizer_config.json +1 -1
- vocab.json +4 -4
fix_tokens.py
CHANGED
|
@@ -107,7 +107,7 @@ SPECIAL_TOKENS_MAP_FILE = SCRIPT_DIR / "special_tokens_map.json"
|
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
-
CHAT_TEMPLATE = "{%- set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 -%}{%- if not has_system -%}{{- '<|im_start|>system\nYou are Olmo, a helpful function-calling AI assistant built by Ai2. Your date cutoff is December 2024, and your model weights are available at https://huggingface.co/allenai. ' -}}{%- if tools is none -%}{{- 'You do not currently have access to any functions. <functions></functions><|im_end|>\n' -}}{%- else -%}{{- 'You are provided with function signatures within <functions></functions> XML tags. You may call one or more functions to assist with the user query. Output any function calls within <function_calls></function_calls> XML tags. Do not make assumptions about what values to plug into functions.' -}}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions><|im_end|>\n' -}}{%- endif -%}{%- endif -%}{%- for message in messages -%}{%- if message['role'] == 'system' -%}{{- '<|im_start|>system\n' + message['content'] -}}{%- if tools is not none -%}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions>' -}}{%- elif message.get('functions', none) is not none -%}{{- ' <functions>' + message['functions'] + '</functions>' -}}{%- endif -%}{{- '<|im_end|>\n' -}}{%- elif message['role'] == 'user' -%}{
|
| 111 |
|
| 112 |
@click.group()
|
| 113 |
def cli():
|
|
|
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
+
CHAT_TEMPLATE = "{%- set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 -%}{%- if not has_system -%}{{- '<|im_start|>system\nYou are Olmo, a helpful function-calling AI assistant built by Ai2. Your date cutoff is December 2024, and your model weights are available at https://huggingface.co/allenai. ' -}}{%- if tools is none -%}{{- 'You do not currently have access to any functions. <functions></functions><|im_end|>\n' -}}{%- else -%}{{- 'You are provided with function signatures within <functions></functions> XML tags. You may call one or more functions to assist with the user query. Output any function calls within <function_calls></function_calls> XML tags. Do not make assumptions about what values to plug into functions.' -}}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions><|im_end|>\n' -}}{%- endif -%}{%- endif -%}{%- for message in messages -%}{%- if message['role'] == 'system' -%}{{- '<|im_start|>system\n' + message['content'] -}}{%- if tools is not none -%}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions>' -}}{%- elif message.get('functions', none) is not none -%}{{- ' <functions>' + message['functions'] + '</functions>' -}}{%- endif -%}{{- '<|im_end|>\n' -}}{%- elif message['role'] == 'user' -%}{{- '<|im_start|>user\n' + message['content'] + '<|im_end|>\n' -}}{%- elif message['role'] == 'assistant' -%}{{- '<|im_start|>assistant\n' -}}{%- if message.get('content', none) is not none -%}{{- message['content'] -}}{%- endif -%}{%- if message.get('function_calls', none) is not none -%}{{- '<function_calls>' + message['function_calls'] + '</function_calls>' -}}{% elif message.get('tool_calls', none) is not none %}{{- '<function_calls>' -}}{%- for tool_call in message['tool_calls'] %}{%- if tool_call is mapping and tool_call.get('function', none) is not none %}{%- set args = tool_call['function']['arguments'] -%}{%- set ns = namespace(arguments_list=[]) -%}{%- for key, value in args.items() -%}{%- set ns.arguments_list = ns.arguments_list + [key ~ '=' ~ (value | tojson)] -%}{%- endfor -%}{%- set arguments = ns.arguments_list | join(', ') -%}{{- tool_call['function']['name'] + '(' + arguments + ')' -}}{%- if not loop.last -%}{{ '\n' }}{%- endif -%}{% else %}{{- tool_call -}}{%- endif %}{%- endfor %}{{- '</function_calls>' -}}{%- endif -%}{%- if not loop.last -%}{{- '<|im_end|>' + '\n' -}}{%- else -%}{{- eos_token -}}{%- endif -%}{%- elif message['role'] == 'environment' -%}{{- '<|im_start|>environment\n' + message['content'] + '<|im_end|>\n' -}}{%- elif message['role'] == 'tool' -%}{{- '<|im_start|>environment\n' + message['content'] + '<|im_end|>\n' -}}{%- endif -%}{%- if loop.last and add_generation_prompt -%}{{- '<|im_start|>assistant\n' -}}{%- endif -%}{%- endfor -%}"
|
| 111 |
|
| 112 |
@click.group()
|
| 113 |
def cli():
|
tokenizer.json
CHANGED
|
@@ -100495,10 +100495,6 @@
|
|
| 100495 |
".WaitFor": 100253,
|
| 100496 |
"Ġdaycare": 100254,
|
| 100497 |
"ĠConveyor": 100255,
|
| 100498 |
-
"<functions>": 100266,
|
| 100499 |
-
"</functions>": 100267,
|
| 100500 |
-
"<function_calls>": 100268,
|
| 100501 |
-
"</function_calls>": 100269,
|
| 100502 |
"<|extra_id_0|>": 100256,
|
| 100503 |
"<|endoftext|>": 100257,
|
| 100504 |
"<|fim_prefix|>": 100258,
|
|
@@ -100509,6 +100505,10 @@
|
|
| 100509 |
"|||IP_ADDRESS|||": 100263,
|
| 100510 |
"<|im_start|>": 100264,
|
| 100511 |
"<|im_end|>": 100265,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100512 |
"<|extra_id_1|>": 100270,
|
| 100513 |
"<|extra_id_2|>": 100271,
|
| 100514 |
"<|extra_id_3|>": 100272,
|
|
|
|
| 100495 |
".WaitFor": 100253,
|
| 100496 |
"Ġdaycare": 100254,
|
| 100497 |
"ĠConveyor": 100255,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100498 |
"<|extra_id_0|>": 100256,
|
| 100499 |
"<|endoftext|>": 100257,
|
| 100500 |
"<|fim_prefix|>": 100258,
|
|
|
|
| 100505 |
"|||IP_ADDRESS|||": 100263,
|
| 100506 |
"<|im_start|>": 100264,
|
| 100507 |
"<|im_end|>": 100265,
|
| 100508 |
+
"<functions>": 100266,
|
| 100509 |
+
"</functions>": 100267,
|
| 100510 |
+
"<function_calls>": 100268,
|
| 100511 |
+
"</function_calls>": 100269,
|
| 100512 |
"<|extra_id_1|>": 100270,
|
| 100513 |
"<|extra_id_2|>": 100271,
|
| 100514 |
"<|extra_id_3|>": 100272,
|
tokenizer_config.json
CHANGED
|
@@ -179,7 +179,7 @@
|
|
| 179 |
}
|
| 180 |
},
|
| 181 |
"bos_token": "<|endoftext|>",
|
| 182 |
-
"chat_template": "{%- set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 -%}{%- if not has_system -%}{{- '<|im_start|>system\nYou are Olmo, a helpful function-calling AI assistant built by Ai2. Your date cutoff is December 2024, and your model weights are available at https://huggingface.co/allenai. ' -}}{%- if tools is none -%}{{- 'You do not currently have access to any functions. <functions></functions><|im_end|>\n' -}}{%- else -%}{{- 'You are provided with function signatures within <functions></functions> XML tags. You may call one or more functions to assist with the user query. Output any function calls within <function_calls></function_calls> XML tags. Do not make assumptions about what values to plug into functions.' -}}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions><|im_end|>\n' -}}{%- endif -%}{%- endif -%}{%- for message in messages -%}{%- if message['role'] == 'system' -%}{{- '<|im_start|>system\n' + message['content'] -}}{%- if tools is not none -%}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions>' -}}{%- elif message.get('functions', none) is not none -%}{{- ' <functions>' + message['functions'] + '</functions>' -}}{%- endif -%}{{- '<|im_end|>\n' -}}{%- elif message['role'] == 'user' -%}{
|
| 183 |
"clean_up_tokenization_spaces": false,
|
| 184 |
"eos_token": "<|endoftext|>",
|
| 185 |
"model_max_length": 65536,
|
|
|
|
| 179 |
}
|
| 180 |
},
|
| 181 |
"bos_token": "<|endoftext|>",
|
| 182 |
+
"chat_template": "{%- set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 -%}{%- if not has_system -%}{{- '<|im_start|>system\nYou are Olmo, a helpful function-calling AI assistant built by Ai2. Your date cutoff is December 2024, and your model weights are available at https://huggingface.co/allenai. ' -}}{%- if tools is none -%}{{- 'You do not currently have access to any functions. <functions></functions><|im_end|>\n' -}}{%- else -%}{{- 'You are provided with function signatures within <functions></functions> XML tags. You may call one or more functions to assist with the user query. Output any function calls within <function_calls></function_calls> XML tags. Do not make assumptions about what values to plug into functions.' -}}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions><|im_end|>\n' -}}{%- endif -%}{%- endif -%}{%- for message in messages -%}{%- if message['role'] == 'system' -%}{{- '<|im_start|>system\n' + message['content'] -}}{%- if tools is not none -%}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions>' -}}{%- elif message.get('functions', none) is not none -%}{{- ' <functions>' + message['functions'] + '</functions>' -}}{%- endif -%}{{- '<|im_end|>\n' -}}{%- elif message['role'] == 'user' -%}{{- '<|im_start|>user\n' + message['content'] + '<|im_end|>\n' -}}{%- elif message['role'] == 'assistant' -%}{{- '<|im_start|>assistant\n' -}}{%- if message.get('content', none) is not none -%}{{- message['content'] -}}{%- endif -%}{%- if message.get('function_calls', none) is not none -%}{{- '<function_calls>' + message['function_calls'] + '</function_calls>' -}}{% elif message.get('tool_calls', none) is not none %}{{- '<function_calls>' -}}{%- for tool_call in message['tool_calls'] %}{%- if tool_call is mapping and tool_call.get('function', none) is not none %}{%- set args = tool_call['function']['arguments'] -%}{%- set ns = namespace(arguments_list=[]) -%}{%- for key, value in args.items() -%}{%- set ns.arguments_list = ns.arguments_list + [key ~ '=' ~ (value | tojson)] -%}{%- endfor -%}{%- set arguments = ns.arguments_list | join(', ') -%}{{- tool_call['function']['name'] + '(' + arguments + ')' -}}{%- if not loop.last -%}{{ '\n' }}{%- endif -%}{% else %}{{- tool_call -}}{%- endif %}{%- endfor %}{{- '</function_calls>' -}}{%- endif -%}{%- if not loop.last -%}{{- '<|im_end|>' + '\n' -}}{%- else -%}{{- eos_token -}}{%- endif -%}{%- elif message['role'] == 'environment' -%}{{- '<|im_start|>environment\n' + message['content'] + '<|im_end|>\n' -}}{%- elif message['role'] == 'tool' -%}{{- '<|im_start|>environment\n' + message['content'] + '<|im_end|>\n' -}}{%- endif -%}{%- if loop.last and add_generation_prompt -%}{{- '<|im_start|>assistant\n' -}}{%- endif -%}{%- endfor -%}",
|
| 183 |
"clean_up_tokenization_spaces": false,
|
| 184 |
"eos_token": "<|endoftext|>",
|
| 185 |
"model_max_length": 65536,
|
vocab.json
CHANGED
|
@@ -100255,10 +100255,6 @@
|
|
| 100255 |
".WaitFor": 100253,
|
| 100256 |
"Ġdaycare": 100254,
|
| 100257 |
"ĠConveyor": 100255,
|
| 100258 |
-
"<functions>": 100266,
|
| 100259 |
-
"</functions>": 100267,
|
| 100260 |
-
"<function_calls>": 100268,
|
| 100261 |
-
"</function_calls>": 100269,
|
| 100262 |
"<|extra_id_0|>": 100256,
|
| 100263 |
"<|endoftext|>": 100257,
|
| 100264 |
"<|fim_prefix|>": 100258,
|
|
@@ -100269,6 +100265,10 @@
|
|
| 100269 |
"|||IP_ADDRESS|||": 100263,
|
| 100270 |
"<|im_start|>": 100264,
|
| 100271 |
"<|im_end|>": 100265,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100272 |
"<|extra_id_1|>": 100270,
|
| 100273 |
"<|extra_id_2|>": 100271,
|
| 100274 |
"<|extra_id_3|>": 100272,
|
|
|
|
| 100255 |
".WaitFor": 100253,
|
| 100256 |
"Ġdaycare": 100254,
|
| 100257 |
"ĠConveyor": 100255,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100258 |
"<|extra_id_0|>": 100256,
|
| 100259 |
"<|endoftext|>": 100257,
|
| 100260 |
"<|fim_prefix|>": 100258,
|
|
|
|
| 100265 |
"|||IP_ADDRESS|||": 100263,
|
| 100266 |
"<|im_start|>": 100264,
|
| 100267 |
"<|im_end|>": 100265,
|
| 100268 |
+
"<functions>": 100266,
|
| 100269 |
+
"</functions>": 100267,
|
| 100270 |
+
"<function_calls>": 100268,
|
| 100271 |
+
"</function_calls>": 100269,
|
| 100272 |
"<|extra_id_1|>": 100270,
|
| 100273 |
"<|extra_id_2|>": 100271,
|
| 100274 |
"<|extra_id_3|>": 100272,
|