zone4007 sapiosaturn commited on
Commit
56c706c
·
0 Parent(s):

Duplicate from arcee-ai/Trinity-Large-Preview

Browse files

Co-authored-by: Varun Singh <sapiosaturn@users.noreply.huggingface.co>

Files changed (42) hide show
  1. .eval_results/mmlu_pro.yaml +8 -0
  2. .gitattributes +36 -0
  3. README.md +223 -0
  4. chat_template.jinja +65 -0
  5. config.json +108 -0
  6. configuration_afmoe.py +133 -0
  7. generation_config.json +9 -0
  8. model-00001-of-00031.safetensors +3 -0
  9. model-00002-of-00031.safetensors +3 -0
  10. model-00003-of-00031.safetensors +3 -0
  11. model-00004-of-00031.safetensors +3 -0
  12. model-00005-of-00031.safetensors +3 -0
  13. model-00006-of-00031.safetensors +3 -0
  14. model-00007-of-00031.safetensors +3 -0
  15. model-00008-of-00031.safetensors +3 -0
  16. model-00009-of-00031.safetensors +3 -0
  17. model-00010-of-00031.safetensors +3 -0
  18. model-00011-of-00031.safetensors +3 -0
  19. model-00012-of-00031.safetensors +3 -0
  20. model-00013-of-00031.safetensors +3 -0
  21. model-00014-of-00031.safetensors +3 -0
  22. model-00015-of-00031.safetensors +3 -0
  23. model-00016-of-00031.safetensors +3 -0
  24. model-00017-of-00031.safetensors +3 -0
  25. model-00018-of-00031.safetensors +3 -0
  26. model-00019-of-00031.safetensors +3 -0
  27. model-00020-of-00031.safetensors +3 -0
  28. model-00021-of-00031.safetensors +3 -0
  29. model-00022-of-00031.safetensors +3 -0
  30. model-00023-of-00031.safetensors +3 -0
  31. model-00024-of-00031.safetensors +3 -0
  32. model-00025-of-00031.safetensors +3 -0
  33. model-00026-of-00031.safetensors +3 -0
  34. model-00027-of-00031.safetensors +3 -0
  35. model-00028-of-00031.safetensors +3 -0
  36. model-00029-of-00031.safetensors +3 -0
  37. model-00030-of-00031.safetensors +3 -0
  38. model-00031-of-00031.safetensors +3 -0
  39. model.safetensors.index.json +0 -0
  40. special_tokens_map.json +23 -0
  41. tokenizer.json +3 -0
  42. tokenizer_config.json +272 -0
.eval_results/mmlu_pro.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: TIGER-Lab/MMLU-Pro
3
+ task_id: mmlu_pro
4
+ value: 75.2
5
+ date: '2026-02-03'
6
+ source:
7
+ url: https://huggingface.co/arcee-ai/Trinity-Large-Preview
8
+ name: Model Card
.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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
README.md ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ - es
6
+ - fr
7
+ - de
8
+ - it
9
+ - pt
10
+ - ru
11
+ - ar
12
+ - hi
13
+ - ko
14
+ - zh
15
+ library_name: transformers
16
+ base_model:
17
+ - arcee-ai/Trinity-Large-Base
18
+ arxiv:
19
+ - 2602.17004
20
+ ---
21
+ <!-- markdownlint-disable first-line-h1 -->
22
+ <!-- markdownlint-disable html -->
23
+ <!-- markdownlint-disable no-duplicate-header -->
24
+
25
+ <div align="center">
26
+ <picture>
27
+ <img
28
+ src="https://cdn-uploads.huggingface.co/production/uploads/6435718aaaef013d1aec3b8b/i-v1KyAMOW_mgVGeic9WJ.png"
29
+ alt="Arcee Trinity Large"
30
+ style="max-width: 100%; height: auto;"
31
+ >
32
+ </picture>
33
+ </div>
34
+ <hr>
35
+
36
+ # Trinity-Large-Preview
37
+
38
+ ## Introduction
39
+
40
+ Trinity-Large-Preview is a 398B-parameter sparse Mixture-of-Experts (MoE) model with approximately 13B active parameters per token. It is the largest model in Arcee AI's Trinity family, trained on more than 17 trillion tokens and delivering frontier-level performance with strong long-context comprehension.
41
+ Trinity-Large-Preview is a lightly post-trained model based on Trinity-Large-Base.
42
+
43
+ Try it at [chat.arcee.ai](http://chat.arcee.ai/)
44
+
45
+ More details on the training of Trinity Large are available in the [technical report](https://github.com/arcee-ai/trinity-large-tech-report/).
46
+
47
+
48
+ ## Model Variants
49
+
50
+ The Trinity Large family consists of three checkpoints from the same training run:
51
+
52
+ - **Trinity-Large-Preview** (this release): Lightly post-trained, chat-ready model undergoing active RL
53
+ - **[Trinity-Large-TrueBase](https://huggingface.co/arcee-ai/Trinity-Large-TrueBase)**: 10T-token pre-anneal pretraining checkpoint
54
+ - **[Trinity-Large-Base](https://huggingface.co/arcee-ai/Trinity-Large-Base)**: Full 17T-token pretrained foundation model with mid-training anneals
55
+
56
+ ## Architecture
57
+
58
+ Trinity-Large-Preview uses a sparse MoE configuration designed to maximize efficiency while maintaining large-scale capacity.
59
+
60
+ | Hyperparameter | Value |
61
+ |:---|:---:|
62
+ | Total parameters | ~398B |
63
+ | Active parameters per token | ~13B |
64
+ | Experts | 256 (1 shared) |
65
+ | Active experts | 4 |
66
+ | Routing strategy | 4-of-256 (1.56% sparsity) |
67
+ | Dense layers | 6 |
68
+ | Pretraining context length | 8,192 |
69
+ | Context length after extension | 512k |
70
+ | Architecture | Sparse MoE (AfmoeForCausalLM) |
71
+
72
+ ## Benchmarks
73
+
74
+ | Benchmark | Llama 4 Maverick | Trinity-Large Preview |
75
+ |-----------|------------------|----------------------|
76
+ | MMLU | 85.5 | 87.2 |
77
+ | MMLU-Pro | 80.5 | 75.2 |
78
+ | GPQA-Diamond | 69.8 | 63.3 |
79
+ | AIME 2025 | 19.3 | 24.0 |
80
+
81
+ ## Training Configuration
82
+
83
+ ### Pretraining
84
+
85
+ - Training tokens: 17 trillion
86
+ - Data partner: [Datology](https://www.datologyai.com/)
87
+
88
+ <div align="center">
89
+ <picture>
90
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/6435718aaaef013d1aec3b8b/sSVjGNHfrJKmQ6w8I18ek.png" style="background-color:ghostwhite;padding:5px;" width="17%" alt="Powered by Datology">
91
+ </picture>
92
+ </div>
93
+
94
+ ## Posttraining
95
+ - This checkpoint was instruction tuned on 20B tokens.
96
+
97
+ ### Infrastructure
98
+
99
+ - Hardware: 2,048 NVIDIA B300 GPUs
100
+ - Parallelism: HSDP + Expert Parallelism
101
+ - Compute partner: [Prime Intellect](https://www.primeintellect.ai/)
102
+
103
+
104
+ <div align="center">
105
+ <picture>
106
+ <img src="https://cdn-avatars.huggingface.co/v1/production/uploads/61e020e4a343274bb132e138/H2mcdPRWtl4iKLd-OYYBc.jpeg" style="background-color:ghostwhite;padding:5px;" width="17%" alt="Powered by Prime Intellect">
107
+ </picture>
108
+ </div>
109
+
110
+ ## Usage
111
+
112
+ ### Running our model
113
+
114
+ - [Transformers](https://huggingface.co/arcee-ai/Trinity-Large-Preview#transformers)
115
+ - [VLLM](https://huggingface.co/arcee-ai/Trinity-Large-Preview#vllm)
116
+ - [llama.cpp](https://huggingface.co/arcee-ai/Trinity-Large-Preview#llamacpp)
117
+ - [LM Studio](https://huggingface.co/arcee-ai/Trinity-Large-Preview#lm-studio)
118
+ - [API](https://huggingface.co/arcee-ai/Trinity-Large-Preview#api)
119
+
120
+
121
+ ### Transformers
122
+
123
+ Use the `main` transformers branch or pass `trust_remote_code=True` with a released version.
124
+
125
+ ```python
126
+ from transformers import AutoTokenizer, AutoModelForCausalLM
127
+ import torch
128
+
129
+ model_id = "arcee-ai/Trinity-Large-Preview"
130
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
131
+ model = AutoModelForCausalLM.from_pretrained(
132
+ model_id,
133
+ torch_dtype=torch.bfloat16,
134
+ device_map="auto",
135
+ trust_remote_code=True
136
+ )
137
+
138
+ messages = [
139
+ {"role": "user", "content": "Who are you?"},
140
+ ]
141
+
142
+ input_ids = tokenizer.apply_chat_template(
143
+ messages,
144
+ add_generation_prompt=True,
145
+ return_tensors="pt"
146
+ ).to(model.device)
147
+
148
+ outputs = model.generate(
149
+ input_ids,
150
+ max_new_tokens=256,
151
+ do_sample=True,
152
+ temperature=0.8,
153
+ top_k=50,
154
+ top_p=0.8
155
+ )
156
+
157
+ response = tokenizer.decode(outputs[0], skip_special_tokens=True)
158
+ print(response)
159
+ ```
160
+
161
+ ### VLLM
162
+
163
+ Supported in VLLM release 0.11.1+
164
+
165
+ ```bash
166
+ vllm serve arcee-ai/Trinity-Large-Preview \
167
+ --dtype bfloat16 \
168
+ --enable-auto-tool-choice \
169
+ --tool-call-parser hermes
170
+ ```
171
+
172
+ ### llama.cpp
173
+
174
+ Supported in llama.cpp release b7061+
175
+
176
+ ```bash
177
+ llama-server -hf arcee-ai/Trinity-Large-Preview-GGUF:q4_k_m
178
+ ```
179
+
180
+ ### LM Studio
181
+
182
+ Supported in the latest LM Studio runtime. Search for `arcee-ai/Trinity-Large-Preview-GGUF` in Model Search.
183
+
184
+ ### API
185
+
186
+ Available on OpenRouter:
187
+
188
+ ```bash
189
+ curl -X POST "https://openrouter.ai/v1/chat/completions" \
190
+ -H "Authorization: Bearer $OPENROUTER_API_KEY" \
191
+ -H "Content-Type: application/json" \
192
+ -d '{
193
+ "model": "arcee-ai/trinity-large-preview",
194
+ "messages": [
195
+ {
196
+ "role": "user",
197
+ "content": "What are some fun things to do in New York?"
198
+ }
199
+ ]
200
+ }'
201
+ ```
202
+
203
+
204
+ ## License
205
+
206
+ Trinity-Large-Preview is released under the Apache License, Version 2.0.
207
+
208
+
209
+ ## Citation
210
+
211
+ If you use this model, please cite:
212
+
213
+ ```bibtex
214
+ @misc{singh2026arceetrinity,
215
+ title = {Arcee Trinity Large Technical Report},
216
+ author = {Varun Singh and Lucas Krauss and Sami Jaghouar and Matej Sirovatka and Charles Goddard and Fares Obied and Jack Min Ong and Jannik Straube and Fern and Aria Harley and Conner Stewart and Colin Kealty and Maziyar Panahi and Simon Kirsten and Anushka Deshpande and Anneketh Vij and Arthur Bresnu and Pranav Veldurthi and Raghav Ravishankar and Hardik Bishnoi and DatologyAI Team and Arcee AI Team and Prime Intellect Team and Mark McQuade and Johannes Hagemann and Lucas Atkins},
217
+ year = {2026},
218
+ eprint = {2602.17004},
219
+ archivePrefix= {arXiv},
220
+ primaryClass = {cs.LG},
221
+ doi = {10.48550/arXiv.2602.17004},
222
+ url = {https://arxiv.org/abs/2602.17004}
223
+ }
chat_template.jinja ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}{%- 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
+ {%- for message in messages %}
18
+ {%- if message.content is string %}
19
+ {%- set content = message.content %}
20
+ {%- else %}
21
+ {%- set content = '' %}
22
+ {%- endif %}
23
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
24
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
25
+ {%- elif message.role == "assistant" %}
26
+ {{- '<|im_start|>' + message.role + '\n' }}
27
+ {% generation %}
28
+ {{- content}}
29
+ {%- if message.tool_calls %}
30
+ {%- for tool_call in message.tool_calls %}
31
+ {%- if (loop.first and content) or (not loop.first) %}
32
+ {{- '\n' }}
33
+ {%- endif %}
34
+ {%- if tool_call.function %}
35
+ {%- set tool_call = tool_call.function %}
36
+ {%- endif %}
37
+ {{- '<tool_call>\n{"name": "' }}
38
+ {{- tool_call.name }}
39
+ {{- '", "arguments": ' }}
40
+ {%- if tool_call.arguments is string %}
41
+ {{- tool_call.arguments }}
42
+ {%- else %}
43
+ {{- tool_call.arguments | tojson }}
44
+ {%- endif %}
45
+ {{- '}\n</tool_call>' }}
46
+ {%- endfor %}
47
+ {%- endif %}
48
+ {{- '<|im_end|>' }}
49
+ {% endgeneration%}
50
+ {{- '\n' }}
51
+ {%- elif message.role == "tool" %}
52
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
53
+ {{- '<|im_start|>user' }}
54
+ {%- endif %}
55
+ {{- '\n<tool_response>\n' }}
56
+ {{- content }}
57
+ {{- '\n</tool_response>' }}
58
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
59
+ {{- '<|im_end|>\n' }}
60
+ {%- endif %}
61
+ {%- endif %}
62
+ {%- endfor %}
63
+ {%- if add_generation_prompt %}
64
+ {{- '<|im_start|>assistant\n' }}
65
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "AfmoeForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_afmoe.AfmoeConfig",
8
+ "AutoModel": "modeling_afmoe.AfmoeModel",
9
+ "AutoModelForCausalLM": "modeling_afmoe.AfmoeForCausalLM"
10
+ },
11
+ "dtype": "bfloat16",
12
+ "global_attn_every_n_layers": 4,
13
+ "head_dim": 128,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 3072,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 12288,
18
+ "layer_types": [
19
+ "sliding_attention",
20
+ "sliding_attention",
21
+ "sliding_attention",
22
+ "full_attention",
23
+ "sliding_attention",
24
+ "sliding_attention",
25
+ "sliding_attention",
26
+ "full_attention",
27
+ "sliding_attention",
28
+ "sliding_attention",
29
+ "sliding_attention",
30
+ "full_attention",
31
+ "sliding_attention",
32
+ "sliding_attention",
33
+ "sliding_attention",
34
+ "full_attention",
35
+ "sliding_attention",
36
+ "sliding_attention",
37
+ "sliding_attention",
38
+ "full_attention",
39
+ "sliding_attention",
40
+ "sliding_attention",
41
+ "sliding_attention",
42
+ "full_attention",
43
+ "sliding_attention",
44
+ "sliding_attention",
45
+ "sliding_attention",
46
+ "full_attention",
47
+ "sliding_attention",
48
+ "sliding_attention",
49
+ "sliding_attention",
50
+ "full_attention",
51
+ "sliding_attention",
52
+ "sliding_attention",
53
+ "sliding_attention",
54
+ "full_attention",
55
+ "sliding_attention",
56
+ "sliding_attention",
57
+ "sliding_attention",
58
+ "full_attention",
59
+ "sliding_attention",
60
+ "sliding_attention",
61
+ "sliding_attention",
62
+ "full_attention",
63
+ "sliding_attention",
64
+ "sliding_attention",
65
+ "sliding_attention",
66
+ "full_attention",
67
+ "sliding_attention",
68
+ "sliding_attention",
69
+ "sliding_attention",
70
+ "full_attention",
71
+ "sliding_attention",
72
+ "sliding_attention",
73
+ "sliding_attention",
74
+ "full_attention",
75
+ "sliding_attention",
76
+ "sliding_attention",
77
+ "sliding_attention",
78
+ "full_attention"
79
+ ],
80
+ "load_balance_coeff": 0.00005,
81
+ "max_position_embeddings": 262144,
82
+ "model_type": "afmoe",
83
+ "moe_intermediate_size": 3072,
84
+ "mup_enabled": true,
85
+ "n_group": 1,
86
+ "num_attention_heads": 48,
87
+ "num_dense_layers": 6,
88
+ "num_expert_groups": 1,
89
+ "num_experts": 256,
90
+ "num_experts_per_tok": 4,
91
+ "num_hidden_layers": 60,
92
+ "num_key_value_heads": 8,
93
+ "num_limited_groups": 1,
94
+ "num_shared_experts": 1,
95
+ "rms_norm_eps": 1e-05,
96
+ "rope_scaling": null,
97
+ "rope_theta": 10000,
98
+ "route_norm": true,
99
+ "route_scale": 2.448,
100
+ "score_func": "sigmoid",
101
+ "sliding_window": 4096,
102
+ "tie_word_embeddings": false,
103
+ "topk_group": 1,
104
+ "transformers_version": "4.57.1",
105
+ "use_cache": true,
106
+ "use_grouped_mm": true,
107
+ "vocab_size": 200192
108
+ }
configuration_afmoe.py ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ from transformers.configuration_utils import PretrainedConfig
16
+ from transformers.modeling_rope_utils import rope_config_validation
17
+ from transformers.configuration_utils import layer_type_validation
18
+ from transformers.utils import logging
19
+
20
+ logger = logging.get_logger(__name__)
21
+
22
+ class AfmoeConfig(PretrainedConfig):
23
+ """
24
+ n_group (`int`, *optional*, defaults to 1):
25
+ Number of groups for routed experts.
26
+ topk_group (`int`, *optional*, defaults to 1):
27
+ Number of selected groups for each token(for each token, ensuring the selected experts is only within `topk_group` groups).
28
+ """
29
+ model_type = "afmoe"
30
+ base_model_pp_plan = {
31
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
32
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
33
+ "norm": (["hidden_states"], ["hidden_states"]),
34
+ }
35
+
36
+ def __init__(
37
+ self,
38
+ num_hidden_layers: int = 32,
39
+ vocab_size: int = 200192,
40
+ hidden_size: int = 2048,
41
+ intermediate_size: int = 6144,
42
+ moe_intermediate_size=1408,
43
+ num_dense_layers=1,
44
+ num_attention_heads=16,
45
+ num_key_value_heads=None,
46
+ head_dim=128,
47
+ hidden_act="silu",
48
+ max_position_embeddings=16384,
49
+ initializer_range=0.02,
50
+ rms_norm_eps=1e-5,
51
+ use_cache=True,
52
+ tie_word_embeddings=False,
53
+ rope_theta=10000.0,
54
+ rope_scaling=None,
55
+ num_experts=64,
56
+ num_experts_per_tok=6,
57
+ num_shared_experts=2,
58
+ num_expert_groups=1,
59
+ num_limited_groups=1,
60
+ score_func="sigmoid",
61
+ route_norm=True,
62
+ route_scale=1.0,
63
+ global_attn_every_n_layers=4,
64
+ sliding_window=1024,
65
+ mup_enabled=False,
66
+ layer_types=None,
67
+ attention_dropout: float = 0.0,
68
+ n_group: int = 1,
69
+ topk_group: int = 1,
70
+ **kwargs,
71
+ ):
72
+ self.vocab_size = vocab_size
73
+ self.max_position_embeddings = max_position_embeddings
74
+ self.hidden_size = hidden_size
75
+ self.intermediate_size = intermediate_size
76
+ self.num_hidden_layers = num_hidden_layers
77
+ self.num_dense_layers = num_dense_layers
78
+ self.num_attention_heads = num_attention_heads
79
+ self.head_dim = head_dim
80
+ self.hidden_act = hidden_act
81
+ self.initializer_range = initializer_range
82
+ self.rms_norm_eps = rms_norm_eps
83
+ self.use_cache = use_cache
84
+ self.rope_theta = rope_theta
85
+ self.rope_scaling = rope_scaling
86
+
87
+
88
+ # MoE specific
89
+ self.moe_intermediate_size = moe_intermediate_size
90
+ self.num_experts_per_tok = num_experts_per_tok
91
+ self.n_group = n_group
92
+ self.topk_group = topk_group
93
+ self.num_experts = num_experts
94
+ self.num_shared_experts = num_shared_experts
95
+ self.num_expert_groups = num_expert_groups
96
+ self.num_limited_groups = num_limited_groups
97
+ self.score_func = score_func
98
+ self.route_norm = route_norm
99
+ self.route_scale = route_scale
100
+
101
+
102
+ # Attention specific
103
+ self.attention_dropout = attention_dropout
104
+ self.global_attn_every_n_layers = global_attn_every_n_layers
105
+ self.sliding_window = sliding_window
106
+ self.layer_types = layer_types
107
+ if self.layer_types is None:
108
+ self.layer_types = [
109
+ "sliding_attention" if bool((i + 1) % global_attn_every_n_layers) else "full_attention" for i in range(self.num_hidden_layers)
110
+ ]
111
+ layer_type_validation(self.layer_types)
112
+
113
+ # muP specific
114
+ self.mup_enabled = mup_enabled
115
+
116
+ if num_key_value_heads is None:
117
+ num_key_value_heads = num_attention_heads
118
+
119
+ self.num_key_value_heads = num_key_value_heads
120
+
121
+
122
+ # Validate rope configs
123
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
124
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
125
+ rope_config_validation(self)
126
+
127
+ super().__init__(
128
+ tie_word_embeddings=tie_word_embeddings,
129
+ **kwargs,
130
+ )
131
+
132
+
133
+ __all__ = ["AfmoeConfig"]
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 3,
5
+ "pad_token_id": 12,
6
+ "transformers_version": "4.57.3",
7
+ "temperature": 0.8,
8
+ "top_p": 0.8
9
+ }
model-00001-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abc9e696257c4d65fa11f392129c3dfecaaa2fe3c4a572f73840ee88ad6221fb
3
+ size 2459965736
model-00002-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf0a02920bc6750b2397e2bf4d82a922404504404f8efe46ad2c8bb1c7d897e9
3
+ size 704696408
model-00003-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:529bec08d7558b4b028bb25dc31333d9b3118e43254b0d7f2a49a4b3e925efc4
3
+ size 704696408
model-00004-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6d4b3c832b7ae965286b209a664f0f3b51912ea5157c00ae6b88ee4048e4dd7
3
+ size 704696408
model-00005-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5c39a196e257c98f6159a8e63f33a8fe083f11e79668683b476bffb1c3cec22
3
+ size 29359328160
model-00006-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe19dbdb61db4e880e4ee22c706d2944a518f8e14f00c5015730dd76c949f7b3
3
+ size 29359328160
model-00007-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ad6b0fdf1b740419194c24516a5548190828c6faa0d0d6e51decf2799d8c985
3
+ size 29359329728
model-00008-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7940b25ac61c123cf37931c5c5624f5fb04496c134417d9aaef19cd92681be70
3
+ size 29359329728
model-00009-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc7453c0e5368ab1cc12a1c200fdaba13d5b1331d467f30971f0fe1777531042
3
+ size 29359329728
model-00010-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85fec4b1a26b292c72140de3a32ae873c377a199009638a3ddeba9d1d6bc88d5
3
+ size 29359329728
model-00011-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ec54b656ed08c9210366041ca515112c8a965d74987560930d75a41e609b4e0
3
+ size 29359329728
model-00012-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:807c63d689ef1adf90c201b8c40e94578bea20f746c56419e4e630bd3ffabc5e
3
+ size 29359329728
model-00013-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4de01f641aef864e9a380fd214311342a5befc700076e4cc2590713a317a5c63
3
+ size 29359329728
model-00014-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:732fa9c1586a8f43ee3bbe8364c9d7496bec04283800fc936c843e49dc649c24
3
+ size 29359329728
model-00015-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c24d9f2ed114cf1b2739f6e622fa50a6cfb963f1d93a412b09ed0635195e924f
3
+ size 29359329728
model-00016-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2cbd47b5b38bfffab863bbd76aedff6aeafd8d5b9af118f0cd9c1d09843fa32
3
+ size 29359329728
model-00017-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c099081adcc09e4473609edb1a8069cf3de243ca601241e81f273eb5410d740a
3
+ size 29359329728
model-00018-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c53be7c5101d32d7fe2d832929049a759ea55d340d2cdb11fff194619561231
3
+ size 29359329728
model-00019-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c4df3f75451b5740aa2bea3b1f9fcc0c6597ec773535f996c1c7c5eeb1569e1
3
+ size 29359329728
model-00020-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c107c2f427a96a8620212884298a5e9850e5ba02b5a310c8a27d187b99a411a6
3
+ size 29359329728
model-00021-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbbe80752f0972113f6facb2a928553721117382f2ff0dce825cc73e21b8923f
3
+ size 29359329728
model-00022-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c82e838e032f638647abba7c89cea19bfe08ba59054927af2a0191327acd1608
3
+ size 29359329728
model-00023-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4b1fb43b32bf1025453c7305681d15abe6294c0ab14f522a6e8c8a13a5f734d
3
+ size 29359329728
model-00024-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:474000b92f3b48bfdde560b4191cb7588413ece620948b711e8b0b06c953b1a8
3
+ size 29359329728
model-00025-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e08d4238d940872960fba67bc202c24268846f1f729bcbe7c201b8479b4708d
3
+ size 29359329728
model-00026-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9f2d5aa61254e42fd8fdf85eb7f0dcc69479000d82649290699c8f494282c55
3
+ size 29359329728
model-00027-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca2aa10c0058b264b7b4cd74e108052343bf1a9e8f1896b7cdd6a99e73a96b08
3
+ size 29359329728
model-00028-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:310cc910bb25f4f4b8bee46e141c807bbde00dac01b7efaeda669bbd950c3754
3
+ size 29359329728
model-00029-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be34656154e1080a42824405e8386f20013c7bc78d080c975efe8c0ac8779903
3
+ size 29359329728
model-00030-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63f091ec2d3a50a7f5286a017bc81623a7b6d286b361d5f765ee8c0dbb02d2d3
3
+ size 29359329728
model-00031-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4cb9e764f53af90b44e1938105f56ce8282381d009d2c019c07de3063b27027
3
+ size 29359329728
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|begin_of_text|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|im_end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|pad|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d864fe0d9c300d44c54006f5960548946d507d8ec05a082a3bff3e49de58208
3
+ size 14614721
tokenizer_config.json ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": null,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<|begin_of_text|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<|end_of_text|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "<|im_start|>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "3": {
31
+ "content": "<|im_end|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "4": {
39
+ "content": "<|eot_id|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": false,
43
+ "single_word": false,
44
+ "special": true
45
+ },
46
+ "5": {
47
+ "content": "<|start|>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": false,
51
+ "single_word": false,
52
+ "special": true
53
+ },
54
+ "6": {
55
+ "content": "<|channel|>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": false,
59
+ "single_word": false,
60
+ "special": true
61
+ },
62
+ "7": {
63
+ "content": "<|message|>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": false,
67
+ "single_word": false,
68
+ "special": true
69
+ },
70
+ "8": {
71
+ "content": "<|end|>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": false,
75
+ "single_word": false,
76
+ "special": true
77
+ },
78
+ "9": {
79
+ "content": "<|fitm_start|>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": false,
83
+ "single_word": false,
84
+ "special": true
85
+ },
86
+ "10": {
87
+ "content": "<|fitm_end|>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": false,
91
+ "single_word": false,
92
+ "special": true
93
+ },
94
+ "11": {
95
+ "content": "<|fitm_hole|>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": false,
99
+ "single_word": false,
100
+ "special": true
101
+ },
102
+ "12": {
103
+ "content": "<|pad|>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": false,
107
+ "single_word": false,
108
+ "special": true
109
+ },
110
+ "13": {
111
+ "content": "<think>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": false
117
+ },
118
+ "14": {
119
+ "content": "</think>",
120
+ "lstrip": false,
121
+ "normalized": false,
122
+ "rstrip": false,
123
+ "single_word": false,
124
+ "special": false
125
+ },
126
+ "15": {
127
+ "content": "<tools>",
128
+ "lstrip": false,
129
+ "normalized": false,
130
+ "rstrip": false,
131
+ "single_word": false,
132
+ "special": false
133
+ },
134
+ "16": {
135
+ "content": "</tools>",
136
+ "lstrip": false,
137
+ "normalized": false,
138
+ "rstrip": false,
139
+ "single_word": false,
140
+ "special": false
141
+ },
142
+ "17": {
143
+ "content": "<tool_call>",
144
+ "lstrip": false,
145
+ "normalized": false,
146
+ "rstrip": false,
147
+ "single_word": false,
148
+ "special": false
149
+ },
150
+ "18": {
151
+ "content": "</tool_call>",
152
+ "lstrip": false,
153
+ "normalized": false,
154
+ "rstrip": false,
155
+ "single_word": false,
156
+ "special": false
157
+ },
158
+ "19": {
159
+ "content": "<tool_response>",
160
+ "lstrip": false,
161
+ "normalized": false,
162
+ "rstrip": false,
163
+ "single_word": false,
164
+ "special": false
165
+ },
166
+ "20": {
167
+ "content": "</tool_response>",
168
+ "lstrip": false,
169
+ "normalized": false,
170
+ "rstrip": false,
171
+ "single_word": false,
172
+ "special": false
173
+ },
174
+ "21": {
175
+ "content": "<|reserved_special_8|>",
176
+ "lstrip": false,
177
+ "normalized": false,
178
+ "rstrip": false,
179
+ "single_word": false,
180
+ "special": true
181
+ },
182
+ "22": {
183
+ "content": "<|reserved_special_9|>",
184
+ "lstrip": false,
185
+ "normalized": false,
186
+ "rstrip": false,
187
+ "single_word": false,
188
+ "special": true
189
+ },
190
+ "23": {
191
+ "content": "<|reserved_special_10|>",
192
+ "lstrip": false,
193
+ "normalized": false,
194
+ "rstrip": false,
195
+ "single_word": false,
196
+ "special": true
197
+ },
198
+ "24": {
199
+ "content": "<|reserved_special_11|>",
200
+ "lstrip": false,
201
+ "normalized": false,
202
+ "rstrip": false,
203
+ "single_word": false,
204
+ "special": true
205
+ },
206
+ "25": {
207
+ "content": "<|reserved_special_12|>",
208
+ "lstrip": false,
209
+ "normalized": false,
210
+ "rstrip": false,
211
+ "single_word": false,
212
+ "special": true
213
+ },
214
+ "26": {
215
+ "content": "<|reserved_special_13|>",
216
+ "lstrip": false,
217
+ "normalized": false,
218
+ "rstrip": false,
219
+ "single_word": false,
220
+ "special": true
221
+ },
222
+ "27": {
223
+ "content": "<|reserved_special_14|>",
224
+ "lstrip": false,
225
+ "normalized": false,
226
+ "rstrip": false,
227
+ "single_word": false,
228
+ "special": true
229
+ },
230
+ "28": {
231
+ "content": "<|reserved_special_15|>",
232
+ "lstrip": false,
233
+ "normalized": false,
234
+ "rstrip": false,
235
+ "single_word": false,
236
+ "special": true
237
+ },
238
+ "29": {
239
+ "content": "<|reserved_special_16|>",
240
+ "lstrip": false,
241
+ "normalized": false,
242
+ "rstrip": false,
243
+ "single_word": false,
244
+ "special": true
245
+ },
246
+ "30": {
247
+ "content": "<|reserved_special_17|>",
248
+ "lstrip": false,
249
+ "normalized": false,
250
+ "rstrip": false,
251
+ "single_word": false,
252
+ "special": true
253
+ },
254
+ "31": {
255
+ "content": "<|reserved_special_18|>",
256
+ "lstrip": false,
257
+ "normalized": false,
258
+ "rstrip": false,
259
+ "single_word": false,
260
+ "special": true
261
+ }
262
+ },
263
+ "bos_token": "<|begin_of_text|>",
264
+ "clean_up_tokenization_spaces": false,
265
+ "eos_token": "<|im_end|>",
266
+ "extra_special_tokens": {},
267
+ "model_max_length": 65536,
268
+ "pad_token": "<|pad|>",
269
+ "tokenizer_class": "PreTrainedTokenizerFast",
270
+ "use_default_system_prompt": false,
271
+ "chat_template": "{{ bos_token }}{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# 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>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\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\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\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 {{- '<|im_start|>' + message.role + '\\n' }}\n {{- content}}\n {%- if message.tool_calls %}\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 {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>' }}\n {{- '\\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 {{- content }}\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 %}"
272
+ }