Upload folder using huggingface_hub
Browse files- config.json +102 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +240 -0
config.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "openbmb/MiniCPM-SALA",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"MiniCPMSALAForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"attn_use_output_gate": true,
|
| 9 |
+
"attn_use_rope": false,
|
| 10 |
+
"auto_map": {
|
| 11 |
+
"AutoConfig": "configuration_minicpm_sala.MiniCPMSALAConfig",
|
| 12 |
+
"AutoModel": "modeling_minicpm_sala.MiniCPMSALAModel",
|
| 13 |
+
"AutoModelForCausalLM": "modeling_minicpm_sala.MiniCPMSALAForCausalLM",
|
| 14 |
+
"AutoModelForSeq2SeqLM": "modeling_minicpm_sala.MiniCPMSALAForCausalLM",
|
| 15 |
+
"AutoModelForSequenceClassification": "modeling_minicpm_sala.MiniCPMSALAForSequenceClassification"
|
| 16 |
+
},
|
| 17 |
+
"bos_token_id": 1,
|
| 18 |
+
"dim_model_base": 256,
|
| 19 |
+
"dtype": "bfloat16",
|
| 20 |
+
"eos_token_id": [
|
| 21 |
+
2,
|
| 22 |
+
73440
|
| 23 |
+
],
|
| 24 |
+
"head_dim": 128,
|
| 25 |
+
"hidden_act": "silu",
|
| 26 |
+
"hidden_size": 4096,
|
| 27 |
+
"initializer_range": 0.1,
|
| 28 |
+
"intermediate_size": 16384,
|
| 29 |
+
"lightning_head_dim": 128,
|
| 30 |
+
"lightning_nh": 32,
|
| 31 |
+
"lightning_nkv": 32,
|
| 32 |
+
"lightning_scale": "1/sqrt(d)",
|
| 33 |
+
"lightning_use_rope": true,
|
| 34 |
+
"max_position_embeddings": 524288,
|
| 35 |
+
"mixer_types": [
|
| 36 |
+
"minicpm4",
|
| 37 |
+
"lightning-attn",
|
| 38 |
+
"lightning-attn",
|
| 39 |
+
"lightning-attn",
|
| 40 |
+
"lightning-attn",
|
| 41 |
+
"lightning-attn",
|
| 42 |
+
"lightning-attn",
|
| 43 |
+
"lightning-attn",
|
| 44 |
+
"lightning-attn",
|
| 45 |
+
"minicpm4",
|
| 46 |
+
"lightning-attn",
|
| 47 |
+
"lightning-attn",
|
| 48 |
+
"lightning-attn",
|
| 49 |
+
"lightning-attn",
|
| 50 |
+
"lightning-attn",
|
| 51 |
+
"lightning-attn",
|
| 52 |
+
"minicpm4",
|
| 53 |
+
"minicpm4",
|
| 54 |
+
"lightning-attn",
|
| 55 |
+
"lightning-attn",
|
| 56 |
+
"lightning-attn",
|
| 57 |
+
"lightning-attn",
|
| 58 |
+
"minicpm4",
|
| 59 |
+
"lightning-attn",
|
| 60 |
+
"lightning-attn",
|
| 61 |
+
"lightning-attn",
|
| 62 |
+
"lightning-attn",
|
| 63 |
+
"lightning-attn",
|
| 64 |
+
"lightning-attn",
|
| 65 |
+
"minicpm4",
|
| 66 |
+
"minicpm4",
|
| 67 |
+
"minicpm4"
|
| 68 |
+
],
|
| 69 |
+
"model_type": "minicpm_sala",
|
| 70 |
+
"mup_denominator": 32,
|
| 71 |
+
"num_attention_heads": 32,
|
| 72 |
+
"num_hidden_layers": 32,
|
| 73 |
+
"num_key_value_heads": 2,
|
| 74 |
+
"pad_token_id": 2,
|
| 75 |
+
"qk_norm": true,
|
| 76 |
+
"quantization": {
|
| 77 |
+
"bits": 8,
|
| 78 |
+
"group_size": 64
|
| 79 |
+
},
|
| 80 |
+
"rand_init": false,
|
| 81 |
+
"rms_norm_eps": 1e-6,
|
| 82 |
+
"rope_theta": 10000.0,
|
| 83 |
+
"scale_depth": 1.4,
|
| 84 |
+
"scale_emb": 12,
|
| 85 |
+
"sparse_config": {
|
| 86 |
+
"block_size": 64,
|
| 87 |
+
"dense_len": 8192,
|
| 88 |
+
"init_blocks": 1,
|
| 89 |
+
"kernel_size": 32,
|
| 90 |
+
"kernel_stride": 16,
|
| 91 |
+
"topk": 64,
|
| 92 |
+
"use_nope": false,
|
| 93 |
+
"window_size": 2048
|
| 94 |
+
},
|
| 95 |
+
"tie_word_embeddings": false,
|
| 96 |
+
"torch_dtype": "bfloat16",
|
| 97 |
+
"transformers_version": "4.56.0",
|
| 98 |
+
"use_cache": true,
|
| 99 |
+
"use_output_gate": true,
|
| 100 |
+
"use_output_norm": true,
|
| 101 |
+
"vocab_size": 73448
|
| 102 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a35688f5eaee7e3bc5b0e10e8eba4daf08ce8991cec7e7a4d1bf02e05df7f5b0
|
| 3 |
+
size 10352021208
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"0": {
|
| 6 |
+
"content": "<unk>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"1": {
|
| 14 |
+
"content": "<s>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"2": {
|
| 22 |
+
"content": "</s>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"101": {
|
| 30 |
+
"content": "<think>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": false
|
| 36 |
+
},
|
| 37 |
+
"102": {
|
| 38 |
+
"content": "</think>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": false
|
| 44 |
+
},
|
| 45 |
+
"103": {
|
| 46 |
+
"content": "<tool_response>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"104": {
|
| 54 |
+
"content": "</tool_response>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"105": {
|
| 62 |
+
"content": "<tools>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"106": {
|
| 70 |
+
"content": "</tools>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"107": {
|
| 78 |
+
"content": "<parameters>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"108": {
|
| 86 |
+
"content": "</parameters>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"109": {
|
| 94 |
+
"content": "<arguments>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"110": {
|
| 102 |
+
"content": "</arguments>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"111": {
|
| 110 |
+
"content": "<function",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"112": {
|
| 118 |
+
"content": "</function>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": true
|
| 124 |
+
},
|
| 125 |
+
"113": {
|
| 126 |
+
"content": "<param",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": true
|
| 132 |
+
},
|
| 133 |
+
"114": {
|
| 134 |
+
"content": "</param>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": true
|
| 140 |
+
},
|
| 141 |
+
"73440": {
|
| 142 |
+
"content": "<|im_end|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": true
|
| 148 |
+
},
|
| 149 |
+
"73441": {
|
| 150 |
+
"content": "<|im_start|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": true
|
| 156 |
+
},
|
| 157 |
+
"73442": {
|
| 158 |
+
"content": "<tool_call>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": true
|
| 164 |
+
},
|
| 165 |
+
"73443": {
|
| 166 |
+
"content": "</tool_call>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": true
|
| 172 |
+
},
|
| 173 |
+
"73444": {
|
| 174 |
+
"content": "<|im_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": true
|
| 180 |
+
},
|
| 181 |
+
"73445": {
|
| 182 |
+
"content": "<|fim_prefix|>",
|
| 183 |
+
"lstrip": false,
|
| 184 |
+
"normalized": false,
|
| 185 |
+
"rstrip": false,
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"special": true
|
| 188 |
+
},
|
| 189 |
+
"73446": {
|
| 190 |
+
"content": "<|fim_middle|>",
|
| 191 |
+
"lstrip": false,
|
| 192 |
+
"normalized": false,
|
| 193 |
+
"rstrip": false,
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"special": true
|
| 196 |
+
},
|
| 197 |
+
"73447": {
|
| 198 |
+
"content": "<|fim_suffix|>",
|
| 199 |
+
"lstrip": false,
|
| 200 |
+
"normalized": false,
|
| 201 |
+
"rstrip": false,
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"special": true
|
| 204 |
+
}
|
| 205 |
+
},
|
| 206 |
+
"additional_special_tokens": [
|
| 207 |
+
"<|im_end|>",
|
| 208 |
+
"<|im_start|>",
|
| 209 |
+
"<tool_call>",
|
| 210 |
+
"</tool_call>",
|
| 211 |
+
"<|im_sep|>",
|
| 212 |
+
"<|fim_prefix|>",
|
| 213 |
+
"<|fim_middle|>",
|
| 214 |
+
"<|fim_suffix|>",
|
| 215 |
+
"<tool_response>",
|
| 216 |
+
"</tool_response>",
|
| 217 |
+
"<tools>",
|
| 218 |
+
"</tools>",
|
| 219 |
+
"<arguments>",
|
| 220 |
+
"</arguments>",
|
| 221 |
+
"<parameters>",
|
| 222 |
+
"</parameters>",
|
| 223 |
+
"<function",
|
| 224 |
+
"</function>",
|
| 225 |
+
"<param",
|
| 226 |
+
"</param>"
|
| 227 |
+
],
|
| 228 |
+
"bos_token": "<s>",
|
| 229 |
+
"clean_up_tokenization_spaces": false,
|
| 230 |
+
"eos_token": "<|im_end|>",
|
| 231 |
+
"legacy": true,
|
| 232 |
+
"model_max_length": 262144,
|
| 233 |
+
"pad_token": "</s>",
|
| 234 |
+
"sp_model_kwargs": {},
|
| 235 |
+
"spaces_between_special_tokens": false,
|
| 236 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 237 |
+
"unk_token": "<unk>",
|
| 238 |
+
"use_default_system_prompt": false,
|
| 239 |
+
"chat_template": "{%- if tools %}\n {%- set tool_definitions %}\n {{- \"# Tools\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson(ensure_ascii=False) }}\n {%- endfor %}\n {{- '\\n</tools>\\n\\nTool usage guidelines:\\n- You may call zero or more functions. If no function calls are needed, just answer normally and do not include any <function ... </function>.\\n- When calling a function, return an XML object within <function ... </function> using:\\n<function name=\"function-name\"><param name=\"param-name\">param-value</param></function>\\n- param-value may be multi-line. If it contains <, & or newline characters, wrap it in a CDATA block: <param name=\"param-name\"><![CDATA[...multi-line value...]]></param>' }}\n {%- endset %}\n \n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {%- if '<tool_def_sep>' in messages[0].content %}\n {{- messages[0].content.replace('<tool_def_sep>', tool_definitions) }}\n {%- else %}\n {{- messages[0].content + '\\n\\n' + tool_definitions }}\n {%- endif %}\n {%- else %}\n {{- tool_definitions.lstrip() }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n \n {%- if message.tool_calls %}\n {%- set content_parts = content.split('<tool_sep>') %}\n {%- set processed_content = content_parts[0] %}\n {%- set tool_calls_count = message.tool_calls|length %}\n {%- set tool_sep_count = content_parts|length - 1 %}\n {%- set min_count = [tool_calls_count, tool_sep_count]|min %}\n \n {%- for i in range(1, content_parts|length) %}\n {%- set tool_index = i - 1 %}\n {%- if tool_index < tool_calls_count %}\n {%- set tool_call = message.tool_calls[tool_index] %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- set single_tool_xml %}\n {{- '<function name=\"' ~ tool_call.name ~ '\">' }}\n {%- if tool_call.arguments %}\n {%- set args_dict = tool_call.arguments %}\n {%- for param_name, param_value in args_dict.items() %}\n {{- '<param name=\"' ~ param_name ~ '\">' }}\n {%- if param_value is string and ('<' in param_value or '&' in param_value or '\\n' in param_value) %}\n {{- '<![CDATA[' + param_value + ']]>' }}\n {%- else %}\n {{- param_value }}\n {%- endif %}\n {{- '</param>' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>' }}\n {%- endset %}\n {%- set processed_content = processed_content + single_tool_xml + content_parts[i] %}\n {%- else %}\n {%- set processed_content = processed_content + content_parts[i] %}\n {%- endif %}\n {%- endfor %}\n \n {%- if tool_calls_count > tool_sep_count %}\n {%- for remaining_index in range(tool_sep_count, tool_calls_count) %}\n {%- set tool_call = message.tool_calls[remaining_index] %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- set remaining_tool_xml %}\n {{- '<function name=\"' ~ tool_call.name ~ '\">' }}\n {%- if tool_call.arguments %}\n {%- set args_dict = tool_call.arguments %}\n {%- for param_name, param_value in args_dict.items() %}\n {{- '<param name=\"' ~ param_name ~ '\">' }}\n {%- if param_value is string and ('<' in param_value or '&' in param_value or '\\n' in param_value) %}\n {{- '<![CDATA[' + param_value + ']]>' }}\n {%- else %}\n {{- param_value }}\n {%- endif %}\n {{- '</param>' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>' }}\n {%- endset %}\n {%- set processed_content = processed_content + remaining_tool_xml %}\n {%- endfor %}\n {%- endif %}\n \n {%- set content = processed_content %}\n {%- endif %}\n \n {%- if loop.index0 > ns.last_query_index %}\n {%- if reasoning_content %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n \n {%- if message.tool_calls and not has_tool_sep %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<function name=\"' ~ tool_call.name ~ '\">' }}\n {%- if tool_call.arguments %}\n {%- set args_dict = tool_call.arguments %}\n {%- for param_name, param_value in args_dict.items() %}\n {{- '<param name=\"' ~ param_name ~ '\">' }}\n {%- if param_value is string and ('<' in param_value or '&' in param_value or '\\n' in param_value) %}\n {{- '<![CDATA[' + param_value + ']]>' }}\n {%- else %}\n {{- param_value }}\n {%- endif %}\n {{- '</param>' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {%- if message.content is string %}\n {{- content }}\n {%- else %}\n {{- message.content | tojson(ensure_ascii=False) }}\n {%- endif %}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}"
|
| 240 |
+
}
|