Update tiny models for HyperCLOVAXForCausalLM
Browse files- chat_template.jinja +108 -0
- config.json +37 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +13 -0
chat_template.jinja
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% if tools is not defined or tools is none %}
|
| 2 |
+
{{- '<|im_start|>tool_list\n<|im_end|>\n' }}
|
| 3 |
+
{%- else %}
|
| 4 |
+
{{- '<|im_start|>tool_list\n[' }}
|
| 5 |
+
{%- for tool in tools %}
|
| 6 |
+
{{- '{"name": "' }}
|
| 7 |
+
{{- tool.function.name }}
|
| 8 |
+
{{- '", ' }}
|
| 9 |
+
{{- '"description": "' }}
|
| 10 |
+
{{- tool.function.description }}
|
| 11 |
+
{{- '"' }}
|
| 12 |
+
{%- if tool.function.parameters is defined %}
|
| 13 |
+
{{- ', "parameters": ' }}
|
| 14 |
+
{{- tool.function.parameters | tojson }}
|
| 15 |
+
{%- endif %}
|
| 16 |
+
{{- '}' }}
|
| 17 |
+
{%- if not loop.last %}
|
| 18 |
+
{{- ', ' }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endfor %}
|
| 21 |
+
{{- ']<|im_end|>\n' }}
|
| 22 |
+
{%- endif %}
|
| 23 |
+
|
| 24 |
+
{%- set ns = namespace(is_searching=true, last_query_index=-1) %}
|
| 25 |
+
{%- for message in messages[::-1] %}
|
| 26 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 27 |
+
{%- if ns.is_searching and (message.role == 'user' or message.role == 'tool') %}
|
| 28 |
+
{%- set ns.last_query_index = index %}
|
| 29 |
+
{%- set ns.is_searching = false %}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
{%- endfor %}
|
| 32 |
+
|
| 33 |
+
{%- for message in messages %}
|
| 34 |
+
{%- if loop.index0 == 0 and message.role != 'system' %}
|
| 35 |
+
{{- '<|im_start|>system\n<|im_end|>\n' }}
|
| 36 |
+
{%- endif %}
|
| 37 |
+
|
| 38 |
+
{%- if message.content is string %}
|
| 39 |
+
{%- set content = message.content %}
|
| 40 |
+
{%- elif message.content is iterable and message.content is not none %}
|
| 41 |
+
{%- set ns_content = namespace(text='') %}
|
| 42 |
+
{%- for part in message.content %}
|
| 43 |
+
{%- if part.type is defined and part.type == 'text' and part.text is defined %}
|
| 44 |
+
{%- set ns_content.text = ns_content.text + part.text %}
|
| 45 |
+
{%- endif %}
|
| 46 |
+
{%- endfor %}
|
| 47 |
+
{%- set content = ns_content.text %}
|
| 48 |
+
{%- else %}
|
| 49 |
+
{%- set content = '' %}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
|
| 52 |
+
{%- set reasoning_content = '' %}
|
| 53 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
| 54 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
{%- if message.role == "assistant" %}
|
| 57 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 58 |
+
{%- if reasoning_content %}
|
| 59 |
+
{{- '<|im_start|>assistant/think\n' + reasoning_content.strip('\n') + '<|im_end|>\n' }}
|
| 60 |
+
{%- endif %}
|
| 61 |
+
{%- endif %}
|
| 62 |
+
|
| 63 |
+
{%- if content %}
|
| 64 |
+
{{- '<|im_start|>assistant\n' + content.strip('\n') + '<|im_end|>' }}
|
| 65 |
+
{%- if message.tool_calls %}
|
| 66 |
+
{{- '\n' }}
|
| 67 |
+
{%- else %}
|
| 68 |
+
{{- '<|endofturn|>\n' }}
|
| 69 |
+
{%- endif %}
|
| 70 |
+
{%- endif %}
|
| 71 |
+
|
| 72 |
+
{%- if message.tool_calls %}
|
| 73 |
+
{{- '<|im_start|>assistant -> tool/function_call\n[' }}
|
| 74 |
+
{%- for tool_call in message.tool_calls %}
|
| 75 |
+
{%- if not loop.first %}
|
| 76 |
+
{{- ', ' }}
|
| 77 |
+
{%- endif %}
|
| 78 |
+
{%- if tool_call.function %}
|
| 79 |
+
{%- set tool_call = tool_call.function %}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{{- '{"name": "' }}
|
| 82 |
+
{{- tool_call.name }}
|
| 83 |
+
{{- '", "arguments": ' }}
|
| 84 |
+
{%- if tool_call.arguments is string %}
|
| 85 |
+
{{- tool_call.arguments }}
|
| 86 |
+
{%- else %}
|
| 87 |
+
{{- tool_call.arguments | tojson }}
|
| 88 |
+
{%- endif %}
|
| 89 |
+
{{- '}' }}
|
| 90 |
+
{%- endfor %}
|
| 91 |
+
{{- ']<|im_end|><|stop|>\n' }}
|
| 92 |
+
|
| 93 |
+
{%- endif %}
|
| 94 |
+
{%- elif message.role == "tool" %}
|
| 95 |
+
{{- '<|im_start|>tool/function_call\n' + content + '<|im_end|>\n' }}
|
| 96 |
+
{%- else %}
|
| 97 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>\n' }}
|
| 98 |
+
{%- endif %}
|
| 99 |
+
{%- endfor %}
|
| 100 |
+
{%- if add_generation_prompt %}
|
| 101 |
+
{%- if force_reasoning is defined and force_reasoning is true %}
|
| 102 |
+
{{- '<|im_start|>assistant/think\n' }}
|
| 103 |
+
{%- elif skip_reasoning is defined and skip_reasoning is true %}
|
| 104 |
+
{{- '<|im_start|>assistant/think\n<|im_end|>\n<|im_start|>assistant\n' }}
|
| 105 |
+
{%- else %}
|
| 106 |
+
{{- '<|im_start|>assistant' }}
|
| 107 |
+
{%- endif %}
|
| 108 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"HyperCLOVAXForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"attention_multiplier": 0.25,
|
| 8 |
+
"bos_token_id": 100257,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"embedding_multiplier": 1.0,
|
| 11 |
+
"eos_token_id": 100257,
|
| 12 |
+
"head_dim": 16,
|
| 13 |
+
"hidden_act": "gelu",
|
| 14 |
+
"hidden_size": 32,
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"intermediate_size": 32,
|
| 17 |
+
"is_decoder": true,
|
| 18 |
+
"logits_scaling": 1.0,
|
| 19 |
+
"max_position_embeddings": 512,
|
| 20 |
+
"mlp_bias": false,
|
| 21 |
+
"model_type": "hyperclovax",
|
| 22 |
+
"num_attention_heads": 2,
|
| 23 |
+
"num_hidden_layers": 2,
|
| 24 |
+
"num_key_value_heads": 2,
|
| 25 |
+
"pad_token_id": 100257,
|
| 26 |
+
"residual_multiplier": 1.0,
|
| 27 |
+
"rms_norm_eps": 1e-06,
|
| 28 |
+
"rope_parameters": {
|
| 29 |
+
"rope_theta": 10000.0,
|
| 30 |
+
"rope_type": "default"
|
| 31 |
+
},
|
| 32 |
+
"tie_word_embeddings": false,
|
| 33 |
+
"transformers_version": "5.16.0.dev0",
|
| 34 |
+
"use_cache": true,
|
| 35 |
+
"use_post_norm": true,
|
| 36 |
+
"vocab_size": 110524
|
| 37 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 100257,
|
| 4 |
+
"eos_token_id": 100257,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 100257,
|
| 8 |
+
"transformers_version": "5.16.0.dev0",
|
| 9 |
+
"use_cache": true
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b6589673ac6270e12c04ae6da3f5f9c99f19fb9f07b594851941215c91337af6
|
| 3 |
+
size 28355264
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"clean_up_tokenization_spaces": true,
|
| 6 |
+
"eos_token": "<|endoftext|>",
|
| 7 |
+
"is_local": true,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"model_max_length": 512,
|
| 10 |
+
"pad_token": "<|endoftext|>",
|
| 11 |
+
"tokenizer_class": "TokenizersBackend",
|
| 12 |
+
"unk_token": "<|endoftext|>"
|
| 13 |
+
}
|