hf-transformers-bot commited on
Commit
f6363d1
·
verified ·
1 Parent(s): c2ba767

Update tiny models for LongcatFlashForCausalLM

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set tool_choice = tool_choice | default('auto') %}
2
+ {%- set ns = namespace(rounds = 0, tool_types = [], last_query_index = -1) %}
3
+
4
+ {%- if tools and tool_choice != 'none' %}
5
+ {{- "# Tools
6
+ " }}
7
+ {{- "You have access to the following tools:
8
+
9
+ " }}
10
+ {%- for tool in tools %}
11
+ {%- if tool.type in ['code_interpreter', 'function'] %}
12
+ {%- if tool.type not in ns.tool_types %}
13
+ {%- set ns.tool_types = ns.tool_types + [tool.type] %}
14
+ {{- "## Tool namespace: " ~ tool.type ~ "
15
+
16
+ " }}
17
+ {%- endif %}
18
+ {%- if tool.type == 'code_interpreter' %}
19
+ {%- set tool = {"type":"code_interpreter","function":{"name":"code_interpreter_preview","description":"The code will be executed in a stateful Jupyter notebook sandbox environment, only supports local computation, data processing, and file operations.
20
+ Code sandbox environment (network isolated) Any external network requests or online API calls are prohibited.
21
+ If online functionality is needed, please use other permitted tools.
22
+ Code will respond with the output of the execution or time out after 60.0 seconds. ","parameters":{"type":"object","properties":{"language":{"type":"string","description":"The programming language of the code to be executed. Available values: python (Default), java, go, js, ts, c, c++."},"code":{"type":"string","description":"Python code to be executed must not include the following:
23
+ - Importing network libraries such as requests, httplib, etc.
24
+ - Any form of HTTP requests.
25
+ - External API calls.
26
+ - Network port operations. Example: ```python
27
+ import pandas as pd
28
+ pd.DataFrame({'A':[1,2]})
29
+ ```"},"timeout":{"type":"number","description":"The maximum execution time of the code, in seconds. Default is 60.0."}}},"required":["code"]}} %}
30
+ {%- endif %}
31
+ {{- "### Tool name: " + tool.function.name + "
32
+
33
+ " }}
34
+ {{- "Description: " + tool.function.description + "
35
+
36
+ " }}
37
+ {{- "InputSchema:
38
+ " + tool.function.parameters | tojson(indent=2) + "
39
+
40
+ " }}
41
+ {%- endif %}
42
+ {%- endfor %}
43
+ {{- '**Note**: For each function call, return a json object with function name and arguments within <longcat_tool_call></longcat_tool_call> XML tags as follows:
44
+ <longcat_tool_call>
45
+ {"name": <function-name>, "arguments": <args-dict>}
46
+ </longcat_tool_call>
47
+ ' }}
48
+ {{- 'When multiple functions need to be called simultaneously, each function call should be wrapped in its own <longcat_tool_call> tag and placed consecutively. For example:
49
+ <longcat_tool_call>
50
+ {"name": <function-name>, "arguments": <args-dict>}
51
+ </longcat_tool_call><longcat_tool_call>
52
+ {"name": <function-name>, "arguments": <args-dict>}
53
+ </longcat_tool_call>
54
+
55
+ ' }}
56
+ {{- "# Messages
57
+ " }}
58
+
59
+ {%- for idx in range(messages|length - 1) %}
60
+ {%- set msg = messages[idx] %}
61
+ {%- if msg.role == 'assistant' and not msg.tool_calls %}
62
+ {%- set ns.last_query_index = idx %}
63
+ {%- endif %}
64
+ {%- endfor%}
65
+ {%- endif %}
66
+
67
+ {%- for msg in messages %}
68
+ {%- if msg.role == "system" %}
69
+ {{- "SYSTEM:" + msg.content }}
70
+ {%- elif msg.role == "user" %}
71
+ {%- if loop.first %}
72
+ {{- "[Round " ~ (ns.rounds) ~ "] USER:" }}
73
+ {%- else %}
74
+ {{- " [Round " ~ (ns.rounds) ~ "] USER:"}}
75
+ {%- endif %}
76
+ {%- set ns.rounds = ns.rounds + 1 %}
77
+ {%- if msg["files"] %}
78
+ {{- '<longcat_files>
79
+ ' ~ msg.files | tojson(indent=2) ~ '
80
+ </longcat_files>' }}
81
+ {%- endif %}
82
+ {{- msg.content }}
83
+ {%- elif msg.role == "assistant" %}
84
+ {{- " ASSISTANT:" }}
85
+ {%- if enable_thinking == true and msg.reasoning_content and ns.tool_types != [] and loop.index0 > ns.last_query_index %}
86
+ {{- "
87
+ <longcat_think>
88
+ " ~ msg.reasoning_content ~ "
89
+ </longcat_think>
90
+ " }}
91
+ {%- endif %}
92
+ {%- if msg.content%}
93
+ {{- msg.content }}
94
+ {%- endif %}
95
+ {%- if msg.tool_calls %}
96
+ {%- for tool_call in msg.tool_calls -%}
97
+ {{- "<longcat_tool_call>
98
+ " -}}
99
+ {%- if tool_call.function.arguments is string -%}
100
+ {"name": "{{ tool_call.function.name}}", "arguments": {{tool_call.function.arguments}}}
101
+ {%- else -%}
102
+ {"name": "{{ tool_call.function.name}}", "arguments": {{tool_call.function.arguments | tojson}}}
103
+ {%- endif -%}
104
+ {{- "
105
+ </longcat_tool_call>" }}
106
+ {%- endfor %}
107
+ {%- endif %}
108
+ {{- "</longcat_s>" -}}
109
+ {%- elif msg.role == "tool" %}
110
+ {{- " TOOL:" -}}
111
+ {%- if msg.name -%}
112
+ {"name": {{msg.name | tojson}}, "content": {{msg.content | tojson}}}
113
+ {%- else -%}
114
+ {"content": {{msg.content | tojson}}}
115
+ {%- endif -%}
116
+ {%- endif %}
117
+ {%- endfor %}
118
+ {%- if add_generation_prompt %}
119
+ {%- if enable_thinking == true %}
120
+ {{- " /think_on" }}
121
+ {%- if thinking_budget %}
122
+ {%- if thinking_budget < 1024 %}
123
+ {%- set thinking_budget = 1024 %}
124
+ {%- endif%}
125
+ {{- "
126
+ thinking_budget: < " ~ thinking_budget ~ "."}}
127
+ {%- endif %}
128
+ {{- " ASSISTANT:<longcat_think>
129
+ "}}
130
+ {%- elif enable_thinking == false %}
131
+ {{- " /think_off ASSISTANT:<longcat_think>
132
+
133
+ </longcat_think>
134
+ " }}
135
+ {%- else %}
136
+ {{- " ASSISTANT:" }}
137
+ {%- endif %}
138
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LongcatFlashForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "dtype": "float32",
9
+ "eos_token_id": 2,
10
+ "expert_ffn_hidden_size": 48,
11
+ "ffn_hidden_size": 288,
12
+ "head_dim": 4,
13
+ "hidden_act": "silu",
14
+ "hidden_size": 144,
15
+ "initializer_range": 0.02,
16
+ "is_decoder": true,
17
+ "kv_lora_rank": 16,
18
+ "max_position_embeddings": 200,
19
+ "model_type": "longcat_flash",
20
+ "moe_topk": 2,
21
+ "n_routed_experts": 4,
22
+ "num_attention_heads": 8,
23
+ "num_hidden_layers": 2,
24
+ "num_key_value_heads": 8,
25
+ "num_layers": 1,
26
+ "pad_token_id": 3,
27
+ "q_lora_rank": 48,
28
+ "qk_head_dim": 12,
29
+ "qk_nope_head_dim": 8,
30
+ "qk_rope_head_dim": 4,
31
+ "rms_norm_eps": 1e-06,
32
+ "rope_parameters": {
33
+ "rope_theta": 10000000.0,
34
+ "rope_type": "default"
35
+ },
36
+ "routed_scaling_factor": 1.0,
37
+ "tie_word_embeddings": false,
38
+ "transformers_version": "5.16.0.dev0",
39
+ "use_cache": true,
40
+ "v_head_dim": 8,
41
+ "vocab_size": 131072,
42
+ "zero_expert_num": 2
43
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "output_attentions": false,
6
+ "output_hidden_states": false,
7
+ "pad_token_id": 3,
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:8a76369071117e0bd9e8e351e27f12ef3a50931a26e46a80e1cdb4e37976e2ab
3
+ size 152650000
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<longcat_s>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "</longcat_s>",
7
+ "is_local": true,
8
+ "local_files_only": false,
9
+ "model_max_length": 200,
10
+ "pad_token": "<longcat_pad>",
11
+ "sp_model_kwargs": {},
12
+ "tokenizer_class": "TokenizersBackend",
13
+ "unk_token": "<longcat_unk>"
14
+ }