Update tiny models for AXK2ForCausalLM
Browse files- .gitattributes +1 -0
- chat_template.jinja +145 -0
- config.json +57 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +21 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 2 |
+
{{- '<|im_start|>system
|
| 3 |
+
당신은 도구 호출 기능을 갖춘 유용한 도우미입니다. 사용자의 요청을 처리하기 위해서 필요한 도구가 주어진 목록에 있는 경우 도구 호출로 응답하세요.
|
| 4 |
+
필요한 도구가 목록에 없는 경우에는 도구 호출 없이 사용자가 요구한 정보를 제공하세요.
|
| 5 |
+
필요한 도구가 목록에 있지만 해당 도구를 호출하는데 필요한 argument 정보가 부족한 경우 해당 정보를 사용자에게 요청하세요.
|
| 6 |
+
사용자의 요청을 처리하기 위해 여러번 도구를 호출할 수 있어야 합니다.
|
| 7 |
+
도구 호출 이후 도구 실행 결과를 입력으로 받으면 해당 결과를 활용하여 답변을 생성하세요.
|
| 8 |
+
|
| 9 |
+
다음은 접근할 수 있는 도구들의 목록 입니다:
|
| 10 |
+
<tools>
|
| 11 |
+
' }}
|
| 12 |
+
{%- for t in tools %}
|
| 13 |
+
{{- t | tojson }}
|
| 14 |
+
{{- '\n' }}
|
| 15 |
+
{%- endfor %}
|
| 16 |
+
{{- '</tools>
|
| 17 |
+
|
| 18 |
+
도구를 호출하려면 아래의 JSON으로 응답하세요.
|
| 19 |
+
도구 호출 형식: <tool_call>{"name": 도구 이름, "arguments": dictionary 형태의 도구 인자값}</tool_call><|im_end|>
|
| 20 |
+
' }}
|
| 21 |
+
{%- endif %}
|
| 22 |
+
|
| 23 |
+
{%- macro render_content(content) -%}
|
| 24 |
+
{#- `content` may be a plain string, none, or a list of parts as sent by
|
| 25 |
+
OpenAI-compatible clients: [{"type": "text", "text": "..."}] -#}
|
| 26 |
+
{%- if content is none -%}
|
| 27 |
+
{%- elif content is string -%}
|
| 28 |
+
{{- content -}}
|
| 29 |
+
{%- elif content is mapping -%}
|
| 30 |
+
{{- content.text if content.text is defined else content -}}
|
| 31 |
+
{%- elif content is sequence -%}
|
| 32 |
+
{%- for part in content -%}
|
| 33 |
+
{%- if part is mapping and part.text is defined -%}
|
| 34 |
+
{{- part.text -}}
|
| 35 |
+
{%- elif part is string -%}
|
| 36 |
+
{{- part -}}
|
| 37 |
+
{%- endif -%}
|
| 38 |
+
{%- endfor -%}
|
| 39 |
+
{%- else -%}
|
| 40 |
+
{{- content -}}
|
| 41 |
+
{%- endif -%}
|
| 42 |
+
{%- endmacro -%}
|
| 43 |
+
|
| 44 |
+
{%- macro render_tool_calls(tool_calls) -%}
|
| 45 |
+
{%- for tool_call in tool_calls -%}
|
| 46 |
+
{%- if tool_call.function is defined -%}
|
| 47 |
+
{%- set tool_call = tool_call.function -%}
|
| 48 |
+
{%- endif -%}
|
| 49 |
+
{{- '<tool_call>\n' -}}
|
| 50 |
+
{{- '{"name": "' + tool_call.name + '"' -}}
|
| 51 |
+
{%- if tool_call.arguments is defined -%}
|
| 52 |
+
{{- ', "arguments": ' -}}
|
| 53 |
+
{#- OpenAI-compatible clients send `arguments` as a JSON string; pass it through -#}
|
| 54 |
+
{%- if tool_call.arguments is string -%}
|
| 55 |
+
{{- tool_call.arguments -}}
|
| 56 |
+
{%- else -%}
|
| 57 |
+
{{- tool_call.arguments | tojson -}}
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- endif -%}
|
| 60 |
+
{{- '}\n</tool_call>' -}}
|
| 61 |
+
{%- endfor -%}
|
| 62 |
+
{%- endmacro -%}
|
| 63 |
+
|
| 64 |
+
{%- set ns = namespace(last_user_index=-1) %}
|
| 65 |
+
{%- for m in messages %}
|
| 66 |
+
{%- if m.role == 'user' %}
|
| 67 |
+
{%- set ns.last_user_index = loop.index0 %}
|
| 68 |
+
{%- endif %}
|
| 69 |
+
{%- endfor %}
|
| 70 |
+
|
| 71 |
+
{%- for message in messages %}
|
| 72 |
+
{%- if message.role == 'system' or message.role == 'user' %}
|
| 73 |
+
{{- '<|im_start|>' + message.role + '\n' }}
|
| 74 |
+
{%- set reasoning_content = '' %}
|
| 75 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
| 76 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 77 |
+
{%- elif message.reasoning is defined and message.reasoning is not none %}
|
| 78 |
+
{%- set reasoning_content = message.reasoning %}
|
| 79 |
+
{%- endif %}
|
| 80 |
+
{%- if reasoning_content %}
|
| 81 |
+
{{- '<think>' + reasoning_content.strip() + '</think>' }}
|
| 82 |
+
{%- endif %}
|
| 83 |
+
{{- render_content(message.content) }}
|
| 84 |
+
{%- if message.tool_calls is defined and message.tool_calls is not none %}
|
| 85 |
+
{{- render_tool_calls(message.tool_calls) }}
|
| 86 |
+
{%- endif %}
|
| 87 |
+
{{- '<|im_end|>\n' }}
|
| 88 |
+
{%- elif message.role == 'assistant' %}
|
| 89 |
+
{{- '<|im_start|>assistant\n' }}
|
| 90 |
+
|
| 91 |
+
{#- Extract reasoning and content -#}
|
| 92 |
+
{%- set reasoning_content = '' %}
|
| 93 |
+
{%- set content = '' %}
|
| 94 |
+
{%- if message.content is defined and message.content is not none %}
|
| 95 |
+
{%- set content = render_content(message.content) %}
|
| 96 |
+
{%- endif %}
|
| 97 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
| 98 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 99 |
+
{%- elif message.reasoning is defined and message.reasoning is not none %}
|
| 100 |
+
{%- set reasoning_content = message.reasoning %}
|
| 101 |
+
{%- elif '</think>' in content %}
|
| 102 |
+
{%- set reasoning_content = content.split('</think>')[0].split('<think>')[-1] %}
|
| 103 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 104 |
+
{%- endif %}
|
| 105 |
+
|
| 106 |
+
{#- Determine whether to render thinking -#}
|
| 107 |
+
{%- set render_thinking = false %}
|
| 108 |
+
{%- if reasoning_content %}
|
| 109 |
+
{%- if show_thinking is defined and show_thinking %}
|
| 110 |
+
{%- set render_thinking = true %}
|
| 111 |
+
{%- elif not (show_thinking is defined and not show_thinking) %}
|
| 112 |
+
{#- show_thinking undefined: show if last turn or tool-call turn after last user -#}
|
| 113 |
+
{%- if loop.last or (message.tool_calls is defined and loop.index0 > ns.last_user_index) %}
|
| 114 |
+
{%- set render_thinking = true %}
|
| 115 |
+
{%- endif %}
|
| 116 |
+
{%- endif %}
|
| 117 |
+
{%- endif %}
|
| 118 |
+
{%- if render_thinking %}
|
| 119 |
+
{{- '<think>' + reasoning_content.strip() + '</think>' }}
|
| 120 |
+
{%- else %}
|
| 121 |
+
{{- '</think>' }}
|
| 122 |
+
{%- endif %}
|
| 123 |
+
|
| 124 |
+
{{- content }}
|
| 125 |
+
{%- if message.tool_calls is defined and message.tool_calls is not none %}
|
| 126 |
+
{{- render_tool_calls(message.tool_calls) }}
|
| 127 |
+
{%- endif %}
|
| 128 |
+
{{- '<|im_end|>' + ('\n' if (not loop.last or add_generation_prompt) else '') }}
|
| 129 |
+
{%- elif message.role == 'tool' %}
|
| 130 |
+
{{- '<|im_start|>tool\n' }}
|
| 131 |
+
{{- '<tool_response>\n' }}
|
| 132 |
+
{{- render_content(message.content) }}
|
| 133 |
+
{{- '\n' }}
|
| 134 |
+
{{- '</tool_response><|im_end|>\n' }}
|
| 135 |
+
{%- endif %}
|
| 136 |
+
{%- endfor %}
|
| 137 |
+
|
| 138 |
+
{%- if add_generation_prompt %}
|
| 139 |
+
{{- '<|im_start|>assistant\n' }}
|
| 140 |
+
{%- if enable_thinking is defined and enable_thinking is true %}
|
| 141 |
+
{{- '<think>' }}
|
| 142 |
+
{%- else %}
|
| 143 |
+
{{- '</think>' }}
|
| 144 |
+
{%- endif %}
|
| 145 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"AXK2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 163691,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 163704,
|
| 10 |
+
"gated_norm_rank": 4,
|
| 11 |
+
"head_dim": 64,
|
| 12 |
+
"hidden_act": "gelu",
|
| 13 |
+
"hidden_size": 32,
|
| 14 |
+
"index_head_dim": 64,
|
| 15 |
+
"index_n_heads": 2,
|
| 16 |
+
"index_topk": 8,
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"intermediate_size": 32,
|
| 19 |
+
"is_decoder": true,
|
| 20 |
+
"kv_lora_rank": 32,
|
| 21 |
+
"layer_types": [
|
| 22 |
+
"deepseek_sparse_attention",
|
| 23 |
+
"deepseek_sparse_attention"
|
| 24 |
+
],
|
| 25 |
+
"max_position_embeddings": 512,
|
| 26 |
+
"mlp_layer_types": [
|
| 27 |
+
"dense",
|
| 28 |
+
"sparse"
|
| 29 |
+
],
|
| 30 |
+
"model_type": "axk2",
|
| 31 |
+
"moe_intermediate_size": 16,
|
| 32 |
+
"n_group": null,
|
| 33 |
+
"n_routed_experts": 8,
|
| 34 |
+
"n_shared_experts": 1,
|
| 35 |
+
"norm_topk_prob": true,
|
| 36 |
+
"num_attention_heads": 2,
|
| 37 |
+
"num_experts_per_tok": 2,
|
| 38 |
+
"num_hidden_layers": 2,
|
| 39 |
+
"num_key_value_heads": 2,
|
| 40 |
+
"pad_token_id": 163692,
|
| 41 |
+
"q_lora_rank": 16,
|
| 42 |
+
"qk_head_dim": 128,
|
| 43 |
+
"qk_nope_head_dim": 64,
|
| 44 |
+
"qk_rope_head_dim": 64,
|
| 45 |
+
"rms_norm_eps": 1e-06,
|
| 46 |
+
"rope_parameters": {
|
| 47 |
+
"rope_theta": 10000.0,
|
| 48 |
+
"rope_type": "default"
|
| 49 |
+
},
|
| 50 |
+
"routed_scaling_factor": 2.5,
|
| 51 |
+
"tie_word_embeddings": false,
|
| 52 |
+
"topk_group": null,
|
| 53 |
+
"transformers_version": "5.16.0.dev0",
|
| 54 |
+
"use_cache": true,
|
| 55 |
+
"v_head_dim": 32,
|
| 56 |
+
"vocab_size": 163840
|
| 57 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 163691,
|
| 4 |
+
"eos_token_id": 163704,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 163692,
|
| 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:d8bb6e9119100c89e61ffe03edc0ba789f479ae635bfbdf83871d1034cc6fe75
|
| 3 |
+
size 42234000
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:af7a63a978968e122296257f015acaf6412a0c57832ead98de556bf740f1750b
|
| 3 |
+
size 13210021
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|endoftext|>",
|
| 4 |
+
"clean_up_tokenization_spaces": true,
|
| 5 |
+
"cls_token": "<|cls|>",
|
| 6 |
+
"eod_token": "<|endoftext|>",
|
| 7 |
+
"eos_token": "<|im_end|>",
|
| 8 |
+
"errors": "replace",
|
| 9 |
+
"is_local": true,
|
| 10 |
+
"local_files_only": false,
|
| 11 |
+
"mask_token": "<|mask|>",
|
| 12 |
+
"model_max_length": 512,
|
| 13 |
+
"model_specific_special_tokens": {
|
| 14 |
+
"eod_token": "<|endoftext|>"
|
| 15 |
+
},
|
| 16 |
+
"pad_token": "<|pad|>",
|
| 17 |
+
"sep_token": "<|sep|>",
|
| 18 |
+
"tokenizer_class": "TokenizersBackend",
|
| 19 |
+
"unk_token": "<|unk|>",
|
| 20 |
+
"vocab_size": 163840
|
| 21 |
+
}
|