Upload folder using huggingface_hub
Browse files- chat_template.jinja +52 -0
- config.json +30 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- tiktoken/tokenizer.model +3 -0
- tokenizer.json +0 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
{{- bos_token }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' -%}
|
| 4 |
+
{%- if messages[1] is not defined or messages[1]['role'] != 'user' -%}
|
| 5 |
+
{{- raise_exception("System message must be followed by a user message") }}
|
| 6 |
+
{%- endif -%}
|
| 7 |
+
{%- set system_content = messages[0]['content'] -%}
|
| 8 |
+
{%- set loop_messages = messages[1:] -%}
|
| 9 |
+
{%- set first_user_has_system = true -%}
|
| 10 |
+
{%- else -%}
|
| 11 |
+
{%- set system_content = "" -%}
|
| 12 |
+
{%- set loop_messages = messages -%}
|
| 13 |
+
{%- set first_user_has_system = false -%}
|
| 14 |
+
{%- endif -%}
|
| 15 |
+
{%- for message in loop_messages -%}
|
| 16 |
+
{%- if message['role'] == 'user' -%}
|
| 17 |
+
{{- '<|user_start|>' }}
|
| 18 |
+
{%- if loop.first and first_user_has_system -%}
|
| 19 |
+
{{- system_content + '\n\n' }}
|
| 20 |
+
{%- endif -%}
|
| 21 |
+
{%- if message['content'] is not string -%}
|
| 22 |
+
{{- raise_exception("User messages must contain string content") }}
|
| 23 |
+
{%- endif -%}
|
| 24 |
+
{{- message['content'] }}
|
| 25 |
+
{{- '<|user_end|>' }}
|
| 26 |
+
{%- elif message['role'] == 'assistant' -%}
|
| 27 |
+
{{- '<|assistant_start|>' }}
|
| 28 |
+
{%- if message['content'] is string -%}
|
| 29 |
+
{{- message['content'] }}
|
| 30 |
+
{%- elif message['content'] is iterable -%}
|
| 31 |
+
{%- for part in message['content'] -%}
|
| 32 |
+
{%- if part['type'] == 'text' -%}
|
| 33 |
+
{{- part.get('text', '') }}
|
| 34 |
+
{%- elif part['type'] == 'python' -%}
|
| 35 |
+
{{- '<|python_start|>' + part.get('text', '') + '<|python_end|>' }}
|
| 36 |
+
{%- elif part['type'] == 'python_output' -%}
|
| 37 |
+
{{- '<|output_start|>' + part.get('text', '') + '<|output_end|>' }}
|
| 38 |
+
{%- else -%}
|
| 39 |
+
{{- raise_exception("Unknown assistant content part: " + part['type']) }}
|
| 40 |
+
{%- endif -%}
|
| 41 |
+
{%- endfor -%}
|
| 42 |
+
{%- else -%}
|
| 43 |
+
{{- raise_exception("Unsupported assistant content type") }}
|
| 44 |
+
{%- endif -%}
|
| 45 |
+
{{- '<|assistant_end|>' }}
|
| 46 |
+
{%- else -%}
|
| 47 |
+
{{- raise_exception("Unexpected message role: " + message['role'] + ". Only 'user' and 'assistant' roles are supported after the optional initial system message.") }}
|
| 48 |
+
{%- endif -%}
|
| 49 |
+
{%- endfor -%}
|
| 50 |
+
{%- if add_generation_prompt -%}
|
| 51 |
+
{{- '<|assistant_start|>' }}
|
| 52 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"NanoChatForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"dtype": "bfloat16",
|
| 9 |
+
"eos_token_id": 1,
|
| 10 |
+
"final_logit_softcapping": 15.0,
|
| 11 |
+
"hidden_act": "relu2",
|
| 12 |
+
"hidden_size": 1280,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 5120,
|
| 15 |
+
"max_position_embeddings": 2048,
|
| 16 |
+
"model_type": "nanochat",
|
| 17 |
+
"num_attention_heads": 10,
|
| 18 |
+
"num_hidden_layers": 20,
|
| 19 |
+
"num_key_value_heads": 10,
|
| 20 |
+
"pad_token_id": 1,
|
| 21 |
+
"rms_norm_eps": 1e-06,
|
| 22 |
+
"rope_parameters": {
|
| 23 |
+
"rope_theta": 10000.0,
|
| 24 |
+
"rope_type": "default"
|
| 25 |
+
},
|
| 26 |
+
"tie_word_embeddings": false,
|
| 27 |
+
"transformers_version": "5.0.0.dev0",
|
| 28 |
+
"use_cache": true,
|
| 29 |
+
"vocab_size": 65536
|
| 30 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 0,
|
| 4 |
+
"eos_token_id": 1,
|
| 5 |
+
"pad_token_id": 1,
|
| 6 |
+
"transformers_version": "5.0.0.dev0"
|
| 7 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:abdf821a5f770f39606d4dd4b2ef4d989d18fa4e4472ac54fbf4bf16c4dd69d2
|
| 3 |
+
size 1121990088
|
tiktoken/tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3f7e6bcd5b4bcdc30bb7cb218a0866a557407f23c1f80ff8be2c353398e1aab5
|
| 3 |
+
size 1196499
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|