danielhanchen commited on
Commit
7f7b83c
1 Parent(s): 12a648d

Upload tokenizer

Browse files
Files changed (3) hide show
  1. README.md +1 -2
  2. tokenizer.json +6 -16
  3. tokenizer_config.json +1 -1
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
  language:
3
  - en
4
- license: apache-2.0
5
  library_name: transformers
 
6
  tags:
7
  - unsloth
8
  - transformers
@@ -10,7 +10,6 @@ tags:
10
  - mistral-7b
11
  - mistral-instruct
12
  - instruct
13
-
14
  ---
15
 
16
  # Finetune Mistral, Gemma, Llama 2-5x faster with 70% less memory via Unsloth!
 
1
  ---
2
  language:
3
  - en
 
4
  library_name: transformers
5
+ license: apache-2.0
6
  tags:
7
  - unsloth
8
  - transformers
 
10
  - mistral-7b
11
  - mistral-instruct
12
  - instruct
 
13
  ---
14
 
15
  # Finetune Mistral, Gemma, Llama 2-5x faster with 70% less memory via Unsloth!
tokenizer.json CHANGED
@@ -6943,23 +6943,13 @@
6943
  "special": true
6944
  }
6945
  ],
6946
- "normalizer": {
6947
- "type": "Sequence",
6948
- "normalizers": [
6949
- {
6950
- "type": "Prepend",
6951
- "prepend": "▁"
6952
- },
6953
- {
6954
- "type": "Replace",
6955
- "pattern": {
6956
- "String": " "
6957
- },
6958
- "content": "▁"
6959
- }
6960
- ]
6961
  },
6962
- "pre_tokenizer": null,
6963
  "post_processor": {
6964
  "type": "TemplateProcessing",
6965
  "single": [
 
6943
  "special": true
6944
  }
6945
  ],
6946
+ "normalizer": null,
6947
+ "pre_tokenizer": {
6948
+ "type": "Metaspace",
6949
+ "replacement": "▁",
6950
+ "prepend_scheme": "first",
6951
+ "split": false
 
 
 
 
 
 
 
 
 
6952
  },
 
6953
  "post_processor": {
6954
  "type": "TemplateProcessing",
6955
  "single": [
tokenizer_config.json CHANGED
@@ -6173,7 +6173,7 @@
6173
  }
6174
  },
6175
  "bos_token": "<s>",
6176
- "chat_template": "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}{{ raise_exception('Conversation roles must alternate user/assistant/user/assistant/...') }}{% endif %}{% 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 %}",
6177
  "clean_up_tokenization_spaces": false,
6178
  "eos_token": "</s>",
6179
  "legacy": false,
 
6173
  }
6174
  },
6175
  "bos_token": "<s>",
6176
+ "chat_template": "{%- if messages[0][\"role\"] == \"system\" %}\n {%- set system_message = messages[0][\"content\"] %}\n {%- set loop_messages = messages[1:] %}\n{%- else %}\n {%- set loop_messages = messages %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n{%- set user_messages = loop_messages | selectattr(\"role\", \"equalto\", \"user\") | list %}\n\n{%- for message in loop_messages | rejectattr(\"role\", \"equalto\", \"tool\") | rejectattr(\"role\", \"equalto\", \"tool_results\") | selectattr(\"tool_calls\", \"undefined\") %}\n {%- if (message[\"role\"] == \"user\") != (loop.index0 % 2 == 0) %}\n {{- raise_exception(\"After the optional system message, conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif %}\n{%- endfor %}\n\n{{- bos_token }}\n{%- for message in loop_messages %}\n {%- if message[\"role\"] == \"user\" %}\n {%- if tools is not none and (message == user_messages[-1]) %}\n {{- \"[AVAILABLE_TOOLS] [\" }}\n {%- for tool in tools %}\n {%- set tool = tool.function %}\n {{- '{\"type\": \"function\", \"function\": {' }}\n {%- for key, val in tool.items() if key != \"return\" %}\n {%- if val is string %}\n {{- '\"' + key + '\": \"' + val + '\"' }}\n {%- else %}\n {{- '\"' + key + '\": ' + val|tojson }}\n {%- endif %}\n {%- if not loop.last %}\n {{- \", \" }}\n {%- endif %}\n {%- endfor %}\n {{- \"}}\" }}\n {%- if not loop.last %}\n {{- \", \" }}\n {%- else %}\n {{- \"]\" }}\n {%- endif %}\n {%- endfor %}\n {{- \"[/AVAILABLE_TOOLS]\" }}\n {%- endif %}\n {%- if loop.last and system_message is defined %}\n {{- \"[INST] \" + system_message + \"\\n\\n\" + message[\"content\"] + \"[/INST]\" }}\n {%- else %}\n {{- \"[INST] \" + message[\"content\"] + \"[/INST]\" }}\n {%- endif %}\n {%- elif message[\"role\"] == \"tool_calls\" or message.tool_calls is defined %}\n {%- if message.tool_calls is defined %}\n {%- set tool_calls = message.tool_calls %}\n {%- else %}\n {%- set tool_calls = message.content %}\n {%- endif %}\n {{- \"[TOOL_CALLS] [\" }}\n {%- for tool_call in tool_calls %}\n {%- set out = tool_call.function|tojson %}\n {{- out[:-1] }}\n {%- if not tool_call.id is defined or tool_call.id|length != 9 %}\n {{- raise_exception(\"Tool call IDs should be alphanumeric strings with length 9!\") }}\n {%- endif %}\n {{- ', \"id\": \"' + tool_call.id + '\"}' }}\n {%- if not loop.last %}\n {{- \", \" }}\n {%- else %}\n {{- \"]\" + eos_token }}\n {%- endif %}\n {%- endfor %}\n {%- elif message[\"role\"] == \"assistant\" %}\n {{- \" \" + message[\"content\"] + eos_token}}\n {%- elif message[\"role\"] == \"tool_results\" or message[\"role\"] == \"tool\" %}\n {%- if message.content is defined and message.content.content is defined %}\n {%- set content = message.content.content %}\n {%- else %}\n {%- set content = message.content %}\n {%- endif %}\n {{- '[TOOL_RESULTS] {\"content\": ' + content|string + \", \" }}\n {%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}\n {{- raise_exception(\"Tool call IDs should be alphanumeric strings with length 9!\") }}\n {%- endif %}\n {{- '\"call_id\": \"' + message.tool_call_id + '\"}[/TOOL_RESULTS]' }}\n {%- else %}\n {{- raise_exception(\"Only user and assistant roles are supported, with the exception of an initial optional system message!\") }}\n {%- endif %}\n{%- endfor %}\n",
6177
  "clean_up_tokenization_spaces": false,
6178
  "eos_token": "</s>",
6179
  "legacy": false,