aggr msr2000 commited on
Commit
a265949
·
verified ·
0 Parent(s):

Duplicate from deepseek-ai/DeepSeek-Prover-V2-7B

Browse files

Co-authored-by: Shirong Ma <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- markdownlint-disable first-line-h1 -->
2
+ <!-- markdownlint-disable html -->
3
+ <!-- markdownlint-disable no-duplicate-header -->
4
+
5
+ <div align="center">
6
+ <img src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/logo.svg?raw=true" width="60%" alt="DeepSeek-V3" />
7
+ </div>
8
+ <hr>
9
+ <div align="center" style="line-height: 1;">
10
+ <a href="https://www.deepseek.com/" target="_blank" style="margin: 2px;">
11
+ <img alt="Homepage" src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/badge.svg?raw=true" style="display: inline-block; vertical-align: middle;"/>
12
+ </a>
13
+ <a href="https://chat.deepseek.com/" target="_blank" style="margin: 2px;">
14
+ <img alt="Chat" src="https://img.shields.io/badge/🤖%20Chat-DeepSeek%20V3-536af5?color=536af5&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
15
+ </a>
16
+ <a href="https://huggingface.co/deepseek-ai" target="_blank" style="margin: 2px;">
17
+ <img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-DeepSeek%20AI-ffc107?color=ffc107&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
18
+ </a>
19
+ </div>
20
+
21
+ <div align="center" style="line-height: 1;">
22
+ <a href="https://discord.gg/Tc7c45Zzu5" target="_blank" style="margin: 2px;">
23
+ <img alt="Discord" src="https://img.shields.io/badge/Discord-DeepSeek%20AI-7289da?logo=discord&logoColor=white&color=7289da" style="display: inline-block; vertical-align: middle;"/>
24
+ </a>
25
+ <a href="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/qr.jpeg?raw=true" target="_blank" style="margin: 2px;">
26
+ <img alt="Wechat" src="https://img.shields.io/badge/WeChat-DeepSeek%20AI-brightgreen?logo=wechat&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
27
+ </a>
28
+ <a href="https://twitter.com/deepseek_ai" target="_blank" style="margin: 2px;">
29
+ <img alt="Twitter Follow" src="https://img.shields.io/badge/Twitter-deepseek_ai-white?logo=x&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
30
+ </a>
31
+ </div>
32
+
33
+ <div align="center" style="line-height: 1;">
34
+ <a href="https://github.com/deepseek-ai/DeepSeek-V3/blob/main/LICENSE-CODE" style="margin: 2px;">
35
+ <img alt="Code License" src="https://img.shields.io/badge/Code_License-MIT-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
36
+ </a>
37
+ <a href="https://github.com/deepseek-ai/DeepSeek-V3/blob/main/LICENSE-MODEL" style="margin: 2px;">
38
+ <img alt="Model License" src="https://img.shields.io/badge/Model_License-Model_Agreement-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
39
+ </a>
40
+ </div>
41
+
42
+ ## 1. Introduction
43
+
44
+ We introduce DeepSeek-Prover-V2, an open-source large language model designed for formal theorem proving in Lean 4, with initialization data collected through a recursive theorem proving pipeline powered by DeepSeek-V3. The cold-start training procedure begins by prompting DeepSeek-V3 to decompose complex problems into a series of subgoals. The proofs of resolved subgoals are synthesized into a chain-of-thought process, combined with DeepSeek-V3's step-by-step reasoning, to create an initial cold start for reinforcement learning. This process enables us to integrate both informal and formal mathematical reasoning into a unified model.
45
+
46
+ <p align="center">
47
+ <img width="100%" src="https://github.com/deepseek-ai/DeepSeek-Prover-V2/blob/main/figures/performance.png?raw=true">
48
+ </p>
49
+
50
+ ## 2. Model Summary
51
+
52
+ ---
53
+
54
+ **Synthesize Cold-Start Reasoning Data through Recursive Proof Search**
55
+
56
+ - To construct the cold-start dataset, we develop a simple yet effective pipeline for recursive theorem proving, utilizing DeepSeek-V3 as a unified tool for both subgoal decomposition and formalization. We prompt DeepSeek-V3 to decompose theorems into high-level proof sketches while simultaneously formalizing these proof steps in Lean 4, resulting in a sequence of subgoals.
57
+
58
+ - We use a smaller 7B model to handle the proof search for each subgoal, thereby reducing the associated computational burden. Once the decomposed steps of a challenging problem are resolved, we pair the complete step-by-step formal proof with the corresponding chain-of-thought from DeepSeek-V3 to create cold-start reasoning data.
59
+
60
+ ---
61
+
62
+ **Reinforcement Learning with Synthetic Cold-Start Data**
63
+
64
+ - We curate a subset of challenging problems that remain unsolved by the 7B prover model in an end-to-end manner, but for which all decomposed subgoals have been successfully resolved. By composing the proofs of all subgoals, we construct a complete formal proof for the original problem. This proof is then appended to DeepSeek-V3's chain-of-thought, which outlines the corresponding lemma decomposition, thereby producing a cohesive synthesis of informal reasoning and subsequent formalization.
65
+
66
+ - After fine-tuning the prover model on the synthetic cold-start data, we perform a reinforcement learning stage to further enhance its ability to bridge informal reasoning with formal proof construction. Following the standard training objective for reasoning models, we use binary correct-or-incorrect feedback as the primary form of reward supervision.
67
+ - The resulting model, DeepSeek-Prover-V2-671B, achieves state-of-the-art performance in neural theorem proving, reaching $88.9$% pass ratio on the MiniF2F-test and solving 49 out of 658 problems from PutnamBench. The proofs generated by DeepSeek-Prover-V2 for the miniF2F dataset are available for download as a [ZIP archive](https://github.com/deepseek-ai/DeepSeek-Prover-V2/blob/master/minif2f-solutions.zip).
68
+
69
+ ---
70
+
71
+ ## 3. ProverBench: Formalization of AIME and Textbook Problems
72
+
73
+ we introduce ProverBench, a benchmark dataset comprising 325 problems. Of these, 15 are formalized from number theory and algebra questions featured in the recent AIME competitions (AIME 24 and 25), offering authentic high-school competition-level challenges. The remaining 310 problems are drawn from curated textbook examples and educational tutorials, contributing a diverse and pedagogically grounded collection of formalized mathematical problems. This benchmark is designed to enable more comprehensive evaluation across both high-school competition problems and undergraduate-level mathematics.
74
+
75
+ <div align="center">
76
+
77
+ | Area | Count |
78
+ | :---------------------: | :-------: |
79
+ | AIME 24&25 | 15 |
80
+ | Number Theory | 40 |
81
+ | Elementary Algebra | 30 |
82
+ | Linear Algebra | 50 |
83
+ | Abstract Algebra | 40 |
84
+ | Calculus | 90 |
85
+ | Real Analysis | 30 |
86
+ | Complex Analysis | 10 |
87
+ | Functional Analysis | 10 |
88
+ | Probability | 10 |
89
+ | Total | 325 |
90
+
91
+ </div>
92
+
93
+ ## 4. Model & Dataset Downloads
94
+
95
+ We release DeepSeek-Prover-V2 in two model sizes: 7B and 671B parameters. DeepSeek-Prover-V2-671B is trained on top of DeepSeek-V3-Base. DeepSeek-Prover-V2-7B is built upon DeepSeek-Prover-V1.5-Base and features an extended context length of up to 32K tokens.
96
+
97
+ <div align="center">
98
+
99
+ | **Model** | **Download** |
100
+ | :-----------------------------: | :----------------------------------------------------------: |
101
+ | DeepSeek-Prover-V2-7B | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-Prover-V2-7B) |
102
+ | DeepSeek-Prover-V2-671B | [🤗 HuggingFace](https://huggingface.co/deepseek-ai/DeepSeek-Prover-V2-671B) |
103
+
104
+ </div>
105
+
106
+ <div align="center">
107
+
108
+ | **Dataset** | **Download** |
109
+ | :-----------------------------: | :----------------------------------------------------------: |
110
+ | DeepSeek-ProverBench | [🤗 HuggingFace](https://huggingface.co/datasets/deepseek-ai/DeepSeek-ProverBench) |
111
+
112
+ </div>
113
+
114
+ ## 5. Quick Start
115
+
116
+ You can directly use [Huggingface's Transformers](https://github.com/huggingface/transformers) for model inference. DeepSeek-Prover-V2-671B shares the same architecture as DeepSeek-V3. For detailed information and supported features, please refer to [the DeepSeek-V3 documentation on Hugging Face](https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/deepseek_v3.md).
117
+
118
+ The following is a basic example of generating a proof for a problem from the miniF2F dataset:
119
+ ````python
120
+ from transformers import AutoModelForCausalLM, AutoTokenizer
121
+ import torch
122
+ torch.manual_seed(30)
123
+
124
+ model_id = "DeepSeek-Prover-V2-7B" # or DeepSeek-Prover-V2-671B
125
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
126
+
127
+ formal_statement = """
128
+ import Mathlib
129
+ import Aesop
130
+
131
+ set_option maxHeartbeats 0
132
+
133
+ open BigOperators Real Nat Topology Rat
134
+
135
+ /-- What is the positive difference between $120\%$ of 30 and $130\%$ of 20? Show that it is 10.-/
136
+ theorem mathd_algebra_10 : abs ((120 : ℝ) / 100 * 30 - 130 / 100 * 20) = 10 := by
137
+ sorry
138
+ """.strip()
139
+
140
+ prompt = """
141
+ Complete the following Lean 4 code:
142
+
143
+ ```lean4
144
+ {}
145
+ ```
146
+
147
+ Before producing the Lean 4 code to formally prove the given theorem, provide a detailed proof plan outlining the main proof steps and strategies.
148
+ The plan should highlight key ideas, intermediate lemmas, and proof structures that will guide the construction of the final formal proof.
149
+ """.strip()
150
+
151
+ chat = [
152
+ {"role": "user", "content": prompt.format(formal_statement)},
153
+ ]
154
+
155
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
156
+ inputs = tokenizer.apply_chat_template(chat, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
157
+
158
+ import time
159
+ start = time.time()
160
+ outputs = model.generate(inputs, max_new_tokens=8192)
161
+ print(tokenizer.batch_decode(outputs))
162
+ print(time.time() - start)
163
+ ````
164
+
165
+ ## 6. License
166
+ The use of DeepSeek-Prover-V2 models is subject to [the Model License](LICENSE-MODEL).
167
+
168
+ ## 7. Contact
169
+
170
+ If you have any questions, please raise an issue or contact us at [[email protected]](mailto:[email protected]).
config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 100000,
8
+ "eos_token_id": 100001,
9
+ "head_dim": 128,
10
+ "hidden_act": "silu",
11
+ "hidden_size": 4096,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 11008,
14
+ "max_position_embeddings": 65536,
15
+ "mlp_bias": false,
16
+ "model_type": "llama",
17
+ "num_attention_heads": 32,
18
+ "num_hidden_layers": 30,
19
+ "num_key_value_heads": 32,
20
+ "pretraining_tp": 1,
21
+ "rms_norm_eps": 1e-06,
22
+ "rope_scaling": {
23
+ "beta_fast": 32,
24
+ "beta_slow": 1,
25
+ "factor": 16,
26
+ "mscale": true,
27
+ "original_max_position_embeddings": 4096,
28
+ "type": "yarn"
29
+ },
30
+ "rope_theta": 10000,
31
+ "tie_word_embeddings": false,
32
+ "torch_dtype": "bfloat16",
33
+ "transformers_version": "4.46.3",
34
+ "use_cache": true,
35
+ "vocab_size": 102400
36
+ }
model-00001-of-000002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7eebe5f578ccfa90eea70b00c164adff6df2bdec511b9939c101234c3e3ae65
3
+ size 8596557586
model-00002-of-000002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7dd518c7ca44e82a7bda20f1959bd131b89f721c70fb3bc2e9ac0b53ad2c4ce9
3
+ size 5224205544
model.safetensors.index.json ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 13820731392
4
+ },
5
+ "weight_map": {
6
+ "model.embed_tokens.weight": "model-00001-of-000002.safetensors",
7
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
8
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
9
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
10
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
11
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
12
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
13
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
14
+ "model.layers.0.input_layernorm.weight": "model-00001-of-000002.safetensors",
15
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
16
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
17
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
18
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
19
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
20
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
21
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
22
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
23
+ "model.layers.1.input_layernorm.weight": "model-00001-of-000002.safetensors",
24
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
25
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
26
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
27
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
28
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
29
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
30
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
31
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
32
+ "model.layers.2.input_layernorm.weight": "model-00001-of-000002.safetensors",
33
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
34
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
35
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
36
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
37
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
38
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
39
+ "model.layers.3.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
40
+ "model.layers.3.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
41
+ "model.layers.3.input_layernorm.weight": "model-00001-of-000002.safetensors",
42
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
43
+ "model.layers.4.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
44
+ "model.layers.4.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
45
+ "model.layers.4.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
46
+ "model.layers.4.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
47
+ "model.layers.4.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
48
+ "model.layers.4.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
49
+ "model.layers.4.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
50
+ "model.layers.4.input_layernorm.weight": "model-00001-of-000002.safetensors",
51
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
52
+ "model.layers.5.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
53
+ "model.layers.5.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
54
+ "model.layers.5.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
55
+ "model.layers.5.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
56
+ "model.layers.5.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
57
+ "model.layers.5.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
58
+ "model.layers.5.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
59
+ "model.layers.5.input_layernorm.weight": "model-00001-of-000002.safetensors",
60
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
61
+ "model.layers.6.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
62
+ "model.layers.6.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
63
+ "model.layers.6.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
64
+ "model.layers.6.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
65
+ "model.layers.6.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
66
+ "model.layers.6.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
67
+ "model.layers.6.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
68
+ "model.layers.6.input_layernorm.weight": "model-00001-of-000002.safetensors",
69
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
70
+ "model.layers.7.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
71
+ "model.layers.7.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
72
+ "model.layers.7.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
73
+ "model.layers.7.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
74
+ "model.layers.7.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
75
+ "model.layers.7.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
76
+ "model.layers.7.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
77
+ "model.layers.7.input_layernorm.weight": "model-00001-of-000002.safetensors",
78
+ "model.layers.7.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
79
+ "model.layers.8.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
80
+ "model.layers.8.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
81
+ "model.layers.8.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
82
+ "model.layers.8.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
83
+ "model.layers.8.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
84
+ "model.layers.8.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
85
+ "model.layers.8.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
86
+ "model.layers.8.input_layernorm.weight": "model-00001-of-000002.safetensors",
87
+ "model.layers.8.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
88
+ "model.layers.9.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
89
+ "model.layers.9.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
90
+ "model.layers.9.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
91
+ "model.layers.9.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
92
+ "model.layers.9.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
93
+ "model.layers.9.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
94
+ "model.layers.9.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
95
+ "model.layers.9.input_layernorm.weight": "model-00001-of-000002.safetensors",
96
+ "model.layers.9.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
97
+ "model.layers.10.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
98
+ "model.layers.10.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
99
+ "model.layers.10.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
100
+ "model.layers.10.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
101
+ "model.layers.10.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
102
+ "model.layers.10.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
103
+ "model.layers.10.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
104
+ "model.layers.10.input_layernorm.weight": "model-00001-of-000002.safetensors",
105
+ "model.layers.10.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
106
+ "model.layers.11.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
107
+ "model.layers.11.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
108
+ "model.layers.11.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
109
+ "model.layers.11.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
110
+ "model.layers.11.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
111
+ "model.layers.11.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
112
+ "model.layers.11.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
113
+ "model.layers.11.input_layernorm.weight": "model-00001-of-000002.safetensors",
114
+ "model.layers.11.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
115
+ "model.layers.12.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
116
+ "model.layers.12.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
117
+ "model.layers.12.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
118
+ "model.layers.12.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
119
+ "model.layers.12.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
120
+ "model.layers.12.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
121
+ "model.layers.12.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
122
+ "model.layers.12.input_layernorm.weight": "model-00001-of-000002.safetensors",
123
+ "model.layers.12.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
124
+ "model.layers.13.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
125
+ "model.layers.13.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
126
+ "model.layers.13.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
127
+ "model.layers.13.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
128
+ "model.layers.13.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
129
+ "model.layers.13.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
130
+ "model.layers.13.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
131
+ "model.layers.13.input_layernorm.weight": "model-00001-of-000002.safetensors",
132
+ "model.layers.13.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
133
+ "model.layers.14.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
134
+ "model.layers.14.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
135
+ "model.layers.14.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
136
+ "model.layers.14.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
137
+ "model.layers.14.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
138
+ "model.layers.14.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
139
+ "model.layers.14.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
140
+ "model.layers.14.input_layernorm.weight": "model-00001-of-000002.safetensors",
141
+ "model.layers.14.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
142
+ "model.layers.15.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
143
+ "model.layers.15.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
144
+ "model.layers.15.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
145
+ "model.layers.15.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
146
+ "model.layers.15.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
147
+ "model.layers.15.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
148
+ "model.layers.15.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
149
+ "model.layers.15.input_layernorm.weight": "model-00001-of-000002.safetensors",
150
+ "model.layers.15.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
151
+ "model.layers.16.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
152
+ "model.layers.16.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
153
+ "model.layers.16.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
154
+ "model.layers.16.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
155
+ "model.layers.16.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
156
+ "model.layers.16.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
157
+ "model.layers.16.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
158
+ "model.layers.16.input_layernorm.weight": "model-00001-of-000002.safetensors",
159
+ "model.layers.16.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
160
+ "model.layers.17.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
161
+ "model.layers.17.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
162
+ "model.layers.17.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
163
+ "model.layers.17.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
164
+ "model.layers.17.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
165
+ "model.layers.17.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
166
+ "model.layers.17.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
167
+ "model.layers.17.input_layernorm.weight": "model-00001-of-000002.safetensors",
168
+ "model.layers.17.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
169
+ "model.layers.18.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
170
+ "model.layers.18.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
171
+ "model.layers.18.self_attn.v_proj.weight": "model-00001-of-000002.safetensors",
172
+ "model.layers.18.self_attn.o_proj.weight": "model-00001-of-000002.safetensors",
173
+ "model.layers.18.mlp.gate_proj.weight": "model-00001-of-000002.safetensors",
174
+ "model.layers.18.mlp.up_proj.weight": "model-00001-of-000002.safetensors",
175
+ "model.layers.18.mlp.down_proj.weight": "model-00001-of-000002.safetensors",
176
+ "model.layers.18.input_layernorm.weight": "model-00001-of-000002.safetensors",
177
+ "model.layers.18.post_attention_layernorm.weight": "model-00001-of-000002.safetensors",
178
+ "model.layers.19.self_attn.q_proj.weight": "model-00001-of-000002.safetensors",
179
+ "model.layers.19.self_attn.k_proj.weight": "model-00001-of-000002.safetensors",
180
+ "model.layers.19.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
181
+ "model.layers.19.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
182
+ "model.layers.19.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
183
+ "model.layers.19.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
184
+ "model.layers.19.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
185
+ "model.layers.19.input_layernorm.weight": "model-00002-of-000002.safetensors",
186
+ "model.layers.19.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
187
+ "model.layers.20.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
188
+ "model.layers.20.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
189
+ "model.layers.20.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
190
+ "model.layers.20.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
191
+ "model.layers.20.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
192
+ "model.layers.20.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
193
+ "model.layers.20.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
194
+ "model.layers.20.input_layernorm.weight": "model-00002-of-000002.safetensors",
195
+ "model.layers.20.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
196
+ "model.layers.21.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
197
+ "model.layers.21.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
198
+ "model.layers.21.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
199
+ "model.layers.21.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
200
+ "model.layers.21.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
201
+ "model.layers.21.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
202
+ "model.layers.21.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
203
+ "model.layers.21.input_layernorm.weight": "model-00002-of-000002.safetensors",
204
+ "model.layers.21.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
205
+ "model.layers.22.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
206
+ "model.layers.22.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
207
+ "model.layers.22.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
208
+ "model.layers.22.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
209
+ "model.layers.22.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
210
+ "model.layers.22.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
211
+ "model.layers.22.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
212
+ "model.layers.22.input_layernorm.weight": "model-00002-of-000002.safetensors",
213
+ "model.layers.22.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
214
+ "model.layers.23.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
215
+ "model.layers.23.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
216
+ "model.layers.23.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
217
+ "model.layers.23.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
218
+ "model.layers.23.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
219
+ "model.layers.23.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
220
+ "model.layers.23.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
221
+ "model.layers.23.input_layernorm.weight": "model-00002-of-000002.safetensors",
222
+ "model.layers.23.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
223
+ "model.layers.24.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
224
+ "model.layers.24.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
225
+ "model.layers.24.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
226
+ "model.layers.24.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
227
+ "model.layers.24.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
228
+ "model.layers.24.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
229
+ "model.layers.24.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
230
+ "model.layers.24.input_layernorm.weight": "model-00002-of-000002.safetensors",
231
+ "model.layers.24.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
232
+ "model.layers.25.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
233
+ "model.layers.25.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
234
+ "model.layers.25.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
235
+ "model.layers.25.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
236
+ "model.layers.25.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
237
+ "model.layers.25.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
238
+ "model.layers.25.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
239
+ "model.layers.25.input_layernorm.weight": "model-00002-of-000002.safetensors",
240
+ "model.layers.25.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
241
+ "model.layers.26.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
242
+ "model.layers.26.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
243
+ "model.layers.26.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
244
+ "model.layers.26.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
245
+ "model.layers.26.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
246
+ "model.layers.26.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
247
+ "model.layers.26.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
248
+ "model.layers.26.input_layernorm.weight": "model-00002-of-000002.safetensors",
249
+ "model.layers.26.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
250
+ "model.layers.27.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
251
+ "model.layers.27.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
252
+ "model.layers.27.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
253
+ "model.layers.27.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
254
+ "model.layers.27.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
255
+ "model.layers.27.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
256
+ "model.layers.27.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
257
+ "model.layers.27.input_layernorm.weight": "model-00002-of-000002.safetensors",
258
+ "model.layers.27.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
259
+ "model.layers.28.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
260
+ "model.layers.28.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
261
+ "model.layers.28.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
262
+ "model.layers.28.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
263
+ "model.layers.28.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
264
+ "model.layers.28.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
265
+ "model.layers.28.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
266
+ "model.layers.28.input_layernorm.weight": "model-00002-of-000002.safetensors",
267
+ "model.layers.28.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
268
+ "model.layers.29.self_attn.q_proj.weight": "model-00002-of-000002.safetensors",
269
+ "model.layers.29.self_attn.k_proj.weight": "model-00002-of-000002.safetensors",
270
+ "model.layers.29.self_attn.v_proj.weight": "model-00002-of-000002.safetensors",
271
+ "model.layers.29.self_attn.o_proj.weight": "model-00002-of-000002.safetensors",
272
+ "model.layers.29.mlp.gate_proj.weight": "model-00002-of-000002.safetensors",
273
+ "model.layers.29.mlp.up_proj.weight": "model-00002-of-000002.safetensors",
274
+ "model.layers.29.mlp.down_proj.weight": "model-00002-of-000002.safetensors",
275
+ "model.layers.29.input_layernorm.weight": "model-00002-of-000002.safetensors",
276
+ "model.layers.29.post_attention_layernorm.weight": "model-00002-of-000002.safetensors",
277
+ "model.norm.weight": "model-00002-of-000002.safetensors",
278
+ "lm_head.weight": "model-00002-of-000002.safetensors"
279
+ }
280
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<|begin▁of▁sentence|>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "clean_up_tokenization_spaces": false,
13
+ "eos_token": {
14
+ "__type": "AddedToken",
15
+ "content": "<|end▁of▁sentence|>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "legacy": true,
22
+ "model_max_length": 131072,
23
+ "pad_token": {
24
+ "__type": "AddedToken",
25
+ "content": "<|end▁of▁sentence|>",
26
+ "lstrip": false,
27
+ "normalized": true,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ "sp_model_kwargs": {},
32
+ "unk_token": null,
33
+ "tokenizer_class": "LlamaTokenizerFast",
34
+ "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='', is_first_sp=true, is_last_user=false) %}{%- for message in messages %}{%- if message['role'] == 'system' %}{%- if ns.is_first_sp %}{% set ns.system_prompt = ns.system_prompt + message['content'] %}{% set ns.is_first_sp = false %}{%- else %}{% set ns.system_prompt = ns.system_prompt + '\n\n' + message['content'] %}{%- endif %}{%- endif %}{%- endfor %}{{ bos_token }}{{ ns.system_prompt }}{%- for message in messages %}{%- if message['role'] == 'user' %}{%- set ns.is_tool = false -%}{%- set ns.is_first = false -%}{%- set ns.is_last_user = true -%}{{'<|User|>' + message['content'] + '<|Assistant|>'}}{%- endif %}{%- if message['role'] == 'assistant' and message['tool_calls'] is defined and message['tool_calls'] is not none %}{%- set ns.is_last_user = false -%}{%- if ns.is_tool %}{{'<|tool▁outputs▁end|>'}}{%- endif %}{%- set ns.is_first = false %}{%- set ns.is_tool = false -%}{%- set ns.is_output_first = true %}{%- for tool in message['tool_calls'] %}{%- if not ns.is_first %}{%- if message['content'] is none %}{{'<|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + tool['function']['arguments'] + '\n' + '```' + '<|tool▁call▁end|>'}}{%- else %}{{message['content'] + '<|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + tool['function']['arguments'] + '\n' + '```' + '<|tool▁call▁end|>'}}{%- endif %}{%- set ns.is_first = true -%}{%- else %}{{'\n' + '<|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + tool['function']['arguments'] + '\n' + '```' + '<|tool▁call▁end|>'}}{%- endif %}{%- endfor %}{{'<|tool▁calls▁end|><|end▁of▁sentence|>'}}{%- endif %}{%- if message['role'] == 'assistant' and (message['tool_calls'] is not defined or message['tool_calls'] is none)%}{%- set ns.is_last_user = false -%}{%- if ns.is_tool %}{{'<|tool▁outputs▁end|>' + message['content'] + '<|end▁of▁sentence|>'}}{%- set ns.is_tool = false -%}{%- else %}{% set content = message['content'] %}{{content + '<|end▁of▁sentence|>'}}{%- endif %}{%- endif %}{%- if message['role'] == 'tool' %}{%- set ns.is_last_user = false -%}{%- set ns.is_tool = true -%}{%- if ns.is_output_first %}{{'<|tool▁outputs▁begin|><|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}}{%- set ns.is_output_first = false %}{%- else %}{{'\n<|tool▁output▁begin|>' + message['content'] + '<|tool▁output▁end|>'}}{%- endif %}{%- endif %}{%- endfor -%}{% if ns.is_tool %}{{'<|tool▁outputs▁end|>'}}{% endif %}{% if add_generation_prompt and not ns.is_last_user and not ns.is_tool %}{{'<|Assistant|>'}}{% endif %}"
35
+ }