Upload folder using huggingface_hub
Browse files- chat_template.jinja +68 -24
- config.json +64 -57
- generation_config.json +14 -0
- model.safetensors +2 -2
- tokenizer.json +2 -2
- tokenizer_config.json +4 -5
chat_template.jinja
CHANGED
|
@@ -1,44 +1,85 @@
|
|
| 1 |
{%- if tools %}
|
| 2 |
{{- '<|im_start|>system\n' }}
|
| 3 |
-
{%- if messages[0]
|
| 4 |
-
{{- messages[0]
|
| 5 |
-
{%- else %}
|
| 6 |
-
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
| 7 |
{%- endif %}
|
| 8 |
-
{{- "
|
| 9 |
{%- for tool in tools %}
|
| 10 |
{{- "\n" }}
|
| 11 |
{{- tool | tojson }}
|
| 12 |
{%- endfor %}
|
| 13 |
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 14 |
{%- else %}
|
| 15 |
-
{%- if messages[0]
|
| 16 |
-
{{- '<|im_start|>system\n' + messages[0]
|
| 17 |
-
{%- else %}
|
| 18 |
-
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
| 19 |
{%- endif %}
|
| 20 |
{%- endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
{%- for message in messages %}
|
| 22 |
-
{%- if (message.role == "user") or (message.role == "system" and not loop.first)
|
| 23 |
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 24 |
{%- elif message.role == "assistant" %}
|
| 25 |
-
{
|
| 26 |
-
{%-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
{%- endif %}
|
| 29 |
-
{%-
|
| 30 |
-
{%- if
|
| 31 |
-
{
|
|
|
|
|
|
|
| 32 |
{%- endif %}
|
| 33 |
-
|
| 34 |
-
{{-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
{
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
{{- '<|im_end|>\n' }}
|
| 40 |
{%- elif message.role == "tool" %}
|
| 41 |
-
{%- if
|
| 42 |
{{- '<|im_start|>user' }}
|
| 43 |
{%- endif %}
|
| 44 |
{{- '\n<tool_response>\n' }}
|
|
@@ -51,4 +92,7 @@
|
|
| 51 |
{%- endfor %}
|
| 52 |
{%- if add_generation_prompt %}
|
| 53 |
{{- '<|im_start|>assistant\n' }}
|
| 54 |
-
{%-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{%- if tools %}
|
| 2 |
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0].role == 'system' %}
|
| 4 |
+
{{- messages[0].content + '\n\n' }}
|
|
|
|
|
|
|
| 5 |
{%- endif %}
|
| 6 |
+
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 7 |
{%- for tool in tools %}
|
| 8 |
{{- "\n" }}
|
| 9 |
{{- tool | tojson }}
|
| 10 |
{%- endfor %}
|
| 11 |
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 12 |
{%- else %}
|
| 13 |
+
{%- if messages[0].role == 'system' %}
|
| 14 |
+
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
|
|
|
|
|
|
| 15 |
{%- endif %}
|
| 16 |
{%- endif %}
|
| 17 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 18 |
+
{%- for forward_message in messages %}
|
| 19 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 20 |
+
{%- set message = messages[index] %}
|
| 21 |
+
{%- set current_content = message.content if message.content is not none else '' %}
|
| 22 |
+
{%- set tool_start = '<tool_response>' %}
|
| 23 |
+
{%- set tool_start_length = tool_start|length %}
|
| 24 |
+
{%- set start_of_message = current_content[:tool_start_length] %}
|
| 25 |
+
{%- set tool_end = '</tool_response>' %}
|
| 26 |
+
{%- set tool_end_length = tool_end|length %}
|
| 27 |
+
{%- set start_pos = (current_content|length) - tool_end_length %}
|
| 28 |
+
{%- if start_pos < 0 %}
|
| 29 |
+
{%- set start_pos = 0 %}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
{%- set end_of_message = current_content[start_pos:] %}
|
| 32 |
+
{%- if ns.multi_step_tool and message.role == "user" and not(start_of_message == tool_start and end_of_message == tool_end) %}
|
| 33 |
+
{%- set ns.multi_step_tool = false %}
|
| 34 |
+
{%- set ns.last_query_index = index %}
|
| 35 |
+
{%- endif %}
|
| 36 |
+
{%- endfor %}
|
| 37 |
{%- for message in messages %}
|
| 38 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 39 |
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 40 |
{%- elif message.role == "assistant" %}
|
| 41 |
+
{%- set content = message.content %}
|
| 42 |
+
{%- set reasoning_content = '' %}
|
| 43 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
| 44 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 45 |
+
{%- else %}
|
| 46 |
+
{%- if '</think>' in message.content %}
|
| 47 |
+
{%- set content = (message.content.split('</think>')|last).lstrip('\n') %}
|
| 48 |
+
{%- set reasoning_content = (message.content.split('</think>')|first).rstrip('\n') %}
|
| 49 |
+
{%- set reasoning_content = (reasoning_content.split('<think>')|last).lstrip('\n') %}
|
| 50 |
+
{%- endif %}
|
| 51 |
{%- endif %}
|
| 52 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 53 |
+
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 54 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 55 |
+
{%- else %}
|
| 56 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 57 |
{%- endif %}
|
| 58 |
+
{%- else %}
|
| 59 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 60 |
+
{%- endif %}
|
| 61 |
+
{%- if message.tool_calls %}
|
| 62 |
+
{%- for tool_call in message.tool_calls %}
|
| 63 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 64 |
+
{{- '\n' }}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
{%- if tool_call.function %}
|
| 67 |
+
{%- set tool_call = tool_call.function %}
|
| 68 |
+
{%- endif %}
|
| 69 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 70 |
+
{{- tool_call.name }}
|
| 71 |
+
{{- '", "arguments": ' }}
|
| 72 |
+
{%- if tool_call.arguments is string %}
|
| 73 |
+
{{- tool_call.arguments }}
|
| 74 |
+
{%- else %}
|
| 75 |
+
{{- tool_call.arguments | tojson }}
|
| 76 |
+
{%- endif %}
|
| 77 |
+
{{- '}\n</tool_call>' }}
|
| 78 |
+
{%- endfor %}
|
| 79 |
+
{%- endif %}
|
| 80 |
{{- '<|im_end|>\n' }}
|
| 81 |
{%- elif message.role == "tool" %}
|
| 82 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 83 |
{{- '<|im_start|>user' }}
|
| 84 |
{%- endif %}
|
| 85 |
{{- '\n<tool_response>\n' }}
|
|
|
|
| 92 |
{%- endfor %}
|
| 93 |
{%- if add_generation_prompt %}
|
| 94 |
{{- '<|im_start|>assistant\n' }}
|
| 95 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 96 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- endif %}
|
config.json
CHANGED
|
@@ -1,58 +1,65 @@
|
|
| 1 |
{
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
"
|
| 40 |
-
"
|
| 41 |
-
"
|
| 42 |
-
"
|
| 43 |
-
"
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
"
|
| 55 |
-
"
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"dtype": "float16",
|
| 9 |
+
"eos_token_id": 151645,
|
| 10 |
+
"head_dim": 128,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 2048,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 6144,
|
| 15 |
+
"layer_types": [
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention"
|
| 44 |
+
],
|
| 45 |
+
"max_position_embeddings": 40960,
|
| 46 |
+
"max_window_layers": 28,
|
| 47 |
+
"model_type": "qwen3",
|
| 48 |
+
"num_attention_heads": 16,
|
| 49 |
+
"num_hidden_layers": 28,
|
| 50 |
+
"num_key_value_heads": 8,
|
| 51 |
+
"pad_token_id": 151669,
|
| 52 |
+
"rms_norm_eps": 1e-06,
|
| 53 |
+
"rope_parameters": {
|
| 54 |
+
"rope_theta": 1000000,
|
| 55 |
+
"rope_type": "default"
|
| 56 |
+
},
|
| 57 |
+
"sliding_window": null,
|
| 58 |
+
"tie_word_embeddings": true,
|
| 59 |
+
"transformers_version": "5.3.0",
|
| 60 |
+
"unsloth_fixed": true,
|
| 61 |
+
"unsloth_version": "2026.3.11",
|
| 62 |
+
"use_cache": true,
|
| 63 |
+
"use_sliding_window": false,
|
| 64 |
+
"vocab_size": 151936
|
| 65 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"max_length": 40960,
|
| 9 |
+
"pad_token_id": 151669,
|
| 10 |
+
"temperature": 0.6,
|
| 11 |
+
"top_k": 20,
|
| 12 |
+
"top_p": 0.95,
|
| 13 |
+
"transformers_version": "5.3.0"
|
| 14 |
+
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3ae9245a6fa9f978e8cdaecb47a41663bd29c12e15c974f717ecc0f4590a188d
|
| 3 |
+
size 3441185296
|
tokenizer.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d7430e9138b76e93fb6f93462394d236b411111aef53cb421ba97d2691040cca
|
| 3 |
+
size 11423114
|
tokenizer_config.json
CHANGED
|
@@ -6,11 +6,10 @@
|
|
| 6 |
"eos_token": "<|im_end|>",
|
| 7 |
"errors": "replace",
|
| 8 |
"is_local": false,
|
| 9 |
-
"model_max_length":
|
| 10 |
-
"pad_token": "<|
|
| 11 |
"padding_side": "left",
|
| 12 |
"split_special_tokens": false,
|
| 13 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 14 |
-
"unk_token": null
|
| 15 |
-
|
| 16 |
-
}
|
|
|
|
| 6 |
"eos_token": "<|im_end|>",
|
| 7 |
"errors": "replace",
|
| 8 |
"is_local": false,
|
| 9 |
+
"model_max_length": 40960,
|
| 10 |
+
"pad_token": "<|PAD_TOKEN|>",
|
| 11 |
"padding_side": "left",
|
| 12 |
"split_special_tokens": false,
|
| 13 |
"tokenizer_class": "Qwen2Tokenizer",
|
| 14 |
+
"unk_token": null
|
| 15 |
+
}
|
|
|