Text Generation
Transformers
Safetensors
qwen3_moe
programming
code generation
code
codeqwen
Mixture of Experts
coding
coder
qwen2
chat
qwen
qwen-coder
Qwen3-Coder-30B-A3B-Instruct
Qwen3-30B-A3B
mixture of experts
128 experts
8 active experts
768k context
qwen3
finetune
brainstorm 20x
brainstorm
optional thinking
conversational
Commit
·
f545556
verified
·
0
Parent(s):
Duplicate from DavidAU/Qwen3-Coder-42B-A3B-Instruct-TOTAL-RECALL-MASTER-CODER-M-512k-ctx
Browse files- .gitattributes +36 -0
- README.md +378 -0
- config.json +44 -0
- merges.txt +0 -0
- model-00001-of-00017.safetensors +3 -0
- model-00002-of-00017.safetensors +3 -0
- model-00003-of-00017.safetensors +3 -0
- model-00004-of-00017.safetensors +3 -0
- model-00005-of-00017.safetensors +3 -0
- model-00006-of-00017.safetensors +3 -0
- model-00007-of-00017.safetensors +3 -0
- model-00008-of-00017.safetensors +3 -0
- model-00009-of-00017.safetensors +3 -0
- model-00010-of-00017.safetensors +3 -0
- model-00011-of-00017.safetensors +3 -0
- model-00012-of-00017.safetensors +3 -0
- model-00013-of-00017.safetensors +3 -0
- model-00014-of-00017.safetensors +3 -0
- model-00015-of-00017.safetensors +3 -0
- model-00016-of-00017.safetensors +3 -0
- model-00017-of-00017.safetensors +3 -0
- model.safetensors.index.json +0 -0
- qwen3-total-recall.gif +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +239 -0
.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 |
+
qwen3-total-recall.gif filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
library_name: transformers
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
- fr
|
7 |
+
- zh
|
8 |
+
- de
|
9 |
+
tags:
|
10 |
+
- programming
|
11 |
+
- code generation
|
12 |
+
- code
|
13 |
+
- codeqwen
|
14 |
+
- programming
|
15 |
+
- code generation
|
16 |
+
- code
|
17 |
+
- codeqwen
|
18 |
+
- moe
|
19 |
+
- coding
|
20 |
+
- coder
|
21 |
+
- qwen2
|
22 |
+
- chat
|
23 |
+
- qwen
|
24 |
+
- qwen-coder
|
25 |
+
- chat
|
26 |
+
- qwen
|
27 |
+
- qwen-coder
|
28 |
+
- moe
|
29 |
+
- Qwen3-Coder-30B-A3B-Instruct
|
30 |
+
- Qwen3-30B-A3B
|
31 |
+
- mixture of experts
|
32 |
+
- 128 experts
|
33 |
+
- 8 active experts
|
34 |
+
- 256k context
|
35 |
+
- qwen3
|
36 |
+
- finetune
|
37 |
+
- brainstorm 20x
|
38 |
+
- brainstorm
|
39 |
+
- optional thinking
|
40 |
+
- qwen3_moe
|
41 |
+
base_model:
|
42 |
+
- Qwen/Qwen3-Coder-30B-A3B-Instruct
|
43 |
+
pipeline_tag: text-generation
|
44 |
+
---
|
45 |
+
|
46 |
+
<h2>Qwen3-Coder-42B-A3B-Instruct-TOTAL-RECALL-MASTER-CODER-M-512k-ctx [512k context]</h2>
|
47 |
+
|
48 |
+
<img src="qwen3-total-recall.gif" style="float:right; width:300px; height:300px; padding:10px;">
|
49 |
+
|
50 |
+
This repo contains the full precision source code, in "safe tensors" format to generate GGUFs, GPTQ, EXL2, AWQ, HQQ and other formats.
|
51 |
+
The source code can also be used directly.
|
52 |
+
|
53 |
+
This model is for CODING and programming in all major programming languages and many minor ones too.
|
54 |
+
|
55 |
+
This model is based on Qwen3-Coder-30B-A3B-Instruct (MOE, 128 experts, 8 activated), with Brainstorm 20X
|
56 |
+
(by DavidAU) - details at bottom of this page.
|
57 |
+
|
58 |
+
The Brainstorm adapter will improve general performance and "out of the box" thinking.
|
59 |
+
|
60 |
+
This creates a model of 42B parameters, 67 layers and 807 tensors.
|
61 |
+
|
62 |
+
This version has the NATIVE context (up from 256k) set via yarn/rope to 512k as per Qwen tech notes.
|
63 |
+
|
64 |
+
This is a non-reasoning/non-thinking block model.
|
65 |
+
|
66 |
+
I have included an optional system prompt to invoke "thinking" in this model, if you want to activate it.
|
67 |
+
|
68 |
+
For coding, programming set expert to:
|
69 |
+
- 6-8 for general work.
|
70 |
+
- 10 for moderate work.
|
71 |
+
- 12-16 for complex work, long projects, complex coding.
|
72 |
+
- Suggest min context window 4k to 8k.
|
73 |
+
- And for longer context, and/or multi-turn -> increase experts by 1-2 to help with longer context/multi turn understanding.
|
74 |
+
|
75 |
+
Recommended settings - general:
|
76 |
+
- Rep pen 1.05 to 1.1 ; however rep pen of 1 will work well (may need to raise it for lower quants/fewer activated experts)
|
77 |
+
- Temp .3 to .6 (+- .2)
|
78 |
+
- Topk of 20, 40 or 100
|
79 |
+
- Topp of .95 / min p of .05
|
80 |
+
- Suggest min context window 4k to 8k.
|
81 |
+
- System prompt (optional) to focus the model better.
|
82 |
+
|
83 |
+
This is the refined version -V1.4- from this project (see this repo for all settings, details, system prompts, example generations etc etc):
|
84 |
+
|
85 |
+
https://huggingface.co/DavidAU/Qwen3-55B-A3B-TOTAL-RECALL-Deep-40X-GGUF/
|
86 |
+
|
87 |
+
This version 2 is slightly smaller, with further refinements to the Brainstorm adapter and uses the new "Qwen3-30B-A3B-Instruct-2507".
|
88 |
+
|
89 |
+
Review and Specialized Settings for this model (V 1.4):
|
90 |
+
|
91 |
+
https://www.linkedin.com/posts/gchesler_davidauqwen3-53b-a3b-total-recall-v14-128k-activity-7344938636141858816-ILCM/
|
92 |
+
|
93 |
+
https://www.linkedin.com/posts/gchesler_haskell-postgres-agentic-activity-7347103276141596672-_zbo/
|
94 |
+
|
95 |
+
You may also want to see (root model of Total Recall series - Version 1):
|
96 |
+
|
97 |
+
https://huggingface.co/Qwen/Qwen3-30B-A3B
|
98 |
+
|
99 |
+
AND Version 2 root model:
|
100 |
+
|
101 |
+
https://huggingface.co/Qwen/Qwen3-Coder-30B-A3B-Instruct
|
102 |
+
|
103 |
+
For additional settings, tool use, and other model settings.
|
104 |
+
|
105 |
+
Summary of root model below, followed by FULL HELP SECTION, then info on Brainstorm 40x.
|
106 |
+
|
107 |
+
OPTIONAL SYSTEM PROMPT - INVOKE "Thinking":
|
108 |
+
|
109 |
+
```
|
110 |
+
Enable deep thinking subroutine. You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside ###ponder### ###/ponder### tags, and then provide your solution or response to the problem.
|
111 |
+
```
|
112 |
+
|
113 |
+
Use this to INVOKE "thinking" block(s) in the model. These will be a lot shorter than 1000s of tokens generally in most "thinking" models.
|
114 |
+
|
115 |
+
In you use this prompt, you may need to raise "rep pen" to 1.08 to 1.1, to prevent "loops" in the "thought block(s)" ; especially in lower quants.
|
116 |
+
|
117 |
+
If you change "ponder" to a different word/phrase this will affect model "thinking" too.
|
118 |
+
|
119 |
+
---
|
120 |
+
|
121 |
+
QUANTS
|
122 |
+
|
123 |
+
---
|
124 |
+
|
125 |
+
- pending -
|
126 |
+
|
127 |
+
---
|
128 |
+
|
129 |
+
# Qwen3-Coder-3B-A3B-Instruct
|
130 |
+
|
131 |
+
## Highlights
|
132 |
+
|
133 |
+
**Qwen3-Coder** is available in multiple sizes. Today, we're excited to introduce **Qwen3-Coder-30B-A3B-Instruct**. This streamlined model maintains impressive performance and efficiency, featuring the following key enhancements:
|
134 |
+
|
135 |
+
- **Significant Performance** among open models on **Agentic Coding**, **Agentic Browser-Use**, and other foundational coding tasks.
|
136 |
+
- **Long-context Capabilities** with native support for **256K** tokens, extendable up to **1M** tokens using Yarn, optimized for repository-scale understanding.
|
137 |
+
- **Agentic Coding** supporting for most platform such as **Qwen Code**, **CLINE**, featuring a specially designed function call format.
|
138 |
+
|
139 |
+

|
140 |
+
|
141 |
+
## Model Overview
|
142 |
+
|
143 |
+
**Qwen3-Coder-30B-A3B-Instruct** has the following features:
|
144 |
+
- Type: Causal Language Models
|
145 |
+
- Training Stage: Pretraining & Post-training
|
146 |
+
- Number of Parameters: 30.5B in total and 3.3B activated
|
147 |
+
- Number of Layers: 48
|
148 |
+
- Number of Attention Heads (GQA): 32 for Q and 4 for KV
|
149 |
+
- Number of Experts: 128
|
150 |
+
- Number of Activated Experts: 8
|
151 |
+
- Context Length: **262,144 natively**.
|
152 |
+
|
153 |
+
**NOTE: This model supports only non-thinking mode and does not generate ``<think></think>`` blocks in its output. Meanwhile, specifying `enable_thinking=False` is no longer required.**
|
154 |
+
|
155 |
+
For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our [blog](https://qwenlm.github.io/blog/qwen3-coder/), [GitHub](https://github.com/QwenLM/Qwen3-Coder), and [Documentation](https://qwen.readthedocs.io/en/latest/).
|
156 |
+
|
157 |
+
|
158 |
+
## Quickstart
|
159 |
+
|
160 |
+
We advise you to use the latest version of `transformers`.
|
161 |
+
|
162 |
+
With `transformers<4.51.0`, you will encounter the following error:
|
163 |
+
```
|
164 |
+
KeyError: 'qwen3_moe'
|
165 |
+
```
|
166 |
+
|
167 |
+
The following contains a code snippet illustrating how to use the model generate content based on given inputs.
|
168 |
+
```python
|
169 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
170 |
+
|
171 |
+
model_name = "Qwen/Qwen3-Coder-30B-A3B-Instruct"
|
172 |
+
|
173 |
+
# load the tokenizer and the model
|
174 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
175 |
+
model = AutoModelForCausalLM.from_pretrained(
|
176 |
+
model_name,
|
177 |
+
torch_dtype="auto",
|
178 |
+
device_map="auto"
|
179 |
+
)
|
180 |
+
|
181 |
+
# prepare the model input
|
182 |
+
prompt = "Write a quick sort algorithm."
|
183 |
+
messages = [
|
184 |
+
{"role": "user", "content": prompt}
|
185 |
+
]
|
186 |
+
text = tokenizer.apply_chat_template(
|
187 |
+
messages,
|
188 |
+
tokenize=False,
|
189 |
+
add_generation_prompt=True,
|
190 |
+
)
|
191 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
192 |
+
|
193 |
+
# conduct text completion
|
194 |
+
generated_ids = model.generate(
|
195 |
+
**model_inputs,
|
196 |
+
max_new_tokens=65536
|
197 |
+
)
|
198 |
+
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
199 |
+
|
200 |
+
content = tokenizer.decode(output_ids, skip_special_tokens=True)
|
201 |
+
|
202 |
+
print("content:", content)
|
203 |
+
```
|
204 |
+
|
205 |
+
**Note: If you encounter out-of-memory (OOM) issues, consider reducing the context length to a shorter value, such as `32,768`.**
|
206 |
+
|
207 |
+
For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.
|
208 |
+
|
209 |
+
## Agentic Coding
|
210 |
+
|
211 |
+
Qwen3-Coder excels in tool calling capabilities.
|
212 |
+
|
213 |
+
You can simply define or use any tools as following example.
|
214 |
+
```python
|
215 |
+
# Your tool implementation
|
216 |
+
def square_the_number(num: float) -> dict:
|
217 |
+
return num ** 2
|
218 |
+
|
219 |
+
# Define Tools
|
220 |
+
tools=[
|
221 |
+
{
|
222 |
+
"type":"function",
|
223 |
+
"function":{
|
224 |
+
"name": "square_the_number",
|
225 |
+
"description": "output the square of the number.",
|
226 |
+
"parameters": {
|
227 |
+
"type": "object",
|
228 |
+
"required": ["input_num"],
|
229 |
+
"properties": {
|
230 |
+
'input_num': {
|
231 |
+
'type': 'number',
|
232 |
+
'description': 'input_num is a number that will be squared'
|
233 |
+
}
|
234 |
+
},
|
235 |
+
}
|
236 |
+
}
|
237 |
+
}
|
238 |
+
]
|
239 |
+
|
240 |
+
import OpenAI
|
241 |
+
# Define LLM
|
242 |
+
client = OpenAI(
|
243 |
+
# Use a custom endpoint compatible with OpenAI API
|
244 |
+
base_url='http://localhost:8000/v1', # api_base
|
245 |
+
api_key="EMPTY"
|
246 |
+
)
|
247 |
+
|
248 |
+
messages = [{'role': 'user', 'content': 'square the number 1024'}]
|
249 |
+
|
250 |
+
completion = client.chat.completions.create(
|
251 |
+
messages=messages,
|
252 |
+
model="Qwen3-Coder-30B-A3B-Instruct",
|
253 |
+
max_tokens=65536,
|
254 |
+
tools=tools,
|
255 |
+
)
|
256 |
+
|
257 |
+
print(completion.choice[0])
|
258 |
+
```
|
259 |
+
|
260 |
+
## Best Practices
|
261 |
+
|
262 |
+
To achieve optimal performance, we recommend the following settings:
|
263 |
+
|
264 |
+
1. **Sampling Parameters**:
|
265 |
+
- We suggest using `temperature=0.7`, `top_p=0.8`, `top_k=20`, `repetition_penalty=1.05`.
|
266 |
+
|
267 |
+
2. **Adequate Output Length**: We recommend using an output length of 65,536 tokens for most queries, which is adequate for instruct models.
|
268 |
+
|
269 |
+
---
|
270 |
+
|
271 |
+
<H2>Help, Adjustments, Samplers, Parameters and More</H2>
|
272 |
+
|
273 |
+
---
|
274 |
+
|
275 |
+
<B>CHANGE THE NUMBER OF ACTIVE EXPERTS:</B>
|
276 |
+
|
277 |
+
See this document:
|
278 |
+
|
279 |
+
https://huggingface.co/DavidAU/How-To-Set-and-Manage-MOE-Mix-of-Experts-Model-Activation-of-Experts
|
280 |
+
|
281 |
+
<B>Settings: CHAT / ROLEPLAY and/or SMOOTHER operation of this model:</B>
|
282 |
+
|
283 |
+
In "KoboldCpp" or "oobabooga/text-generation-webui" or "Silly Tavern" ;
|
284 |
+
|
285 |
+
Set the "Smoothing_factor" to 1.5
|
286 |
+
|
287 |
+
: in KoboldCpp -> Settings->Samplers->Advanced-> "Smooth_F"
|
288 |
+
|
289 |
+
: in text-generation-webui -> parameters -> lower right.
|
290 |
+
|
291 |
+
: In Silly Tavern this is called: "Smoothing"
|
292 |
+
|
293 |
+
|
294 |
+
NOTE: For "text-generation-webui"
|
295 |
+
|
296 |
+
-> if using GGUFs you need to use "llama_HF" (which involves downloading some config files from the SOURCE version of this model)
|
297 |
+
|
298 |
+
Source versions (and config files) of my models are here:
|
299 |
+
|
300 |
+
https://huggingface.co/collections/DavidAU/d-au-source-files-for-gguf-exl2-awq-gptq-hqq-etc-etc-66b55cb8ba25f914cbf210be
|
301 |
+
|
302 |
+
OTHER OPTIONS:
|
303 |
+
|
304 |
+
- Increase rep pen to 1.1 to 1.15 (you don't need to do this if you use "smoothing_factor")
|
305 |
+
|
306 |
+
- If the interface/program you are using to run AI MODELS supports "Quadratic Sampling" ("smoothing") just make the adjustment as noted.
|
307 |
+
|
308 |
+
<B>Highest Quality Settings / Optimal Operation Guide / Parameters and Samplers</B>
|
309 |
+
|
310 |
+
This a "Class 1" model:
|
311 |
+
|
312 |
+
For all settings used for this model (including specifics for its "class"), including example generation(s) and for advanced settings guide (which many times addresses any model issue(s)), including methods to improve model performance for all use case(s) as well as chat, roleplay and other use case(s) please see:
|
313 |
+
|
314 |
+
[ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]
|
315 |
+
|
316 |
+
You can see all parameters used for generation, in addition to advanced parameters and samplers to get the most out of this model here:
|
317 |
+
|
318 |
+
[ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]
|
319 |
+
|
320 |
+
---
|
321 |
+
|
322 |
+
<H2>What is Brainstorm?</H2>
|
323 |
+
|
324 |
+
---
|
325 |
+
|
326 |
+
<B>Brainstorm 20x</B>
|
327 |
+
|
328 |
+
The BRAINSTORM process was developed by David_AU.
|
329 |
+
|
330 |
+
Some of the core principals behind this process are discussed in this <a href="https://arxiv.org/pdf/2401.02415">
|
331 |
+
scientific paper : Progressive LLaMA with Block Expansion </a>.
|
332 |
+
|
333 |
+
However I went in a completely different direction from what was outlined in this paper.
|
334 |
+
|
335 |
+
What is "Brainstorm" ?
|
336 |
+
|
337 |
+
The reasoning center of an LLM is taken apart, reassembled, and expanded.
|
338 |
+
|
339 |
+
In this case for this model: 20 times
|
340 |
+
|
341 |
+
Then these centers are individually calibrated. These "centers" also interact with each other.
|
342 |
+
This introduces subtle changes into the reasoning process.
|
343 |
+
The calibrations further adjust - dial up or down - these "changes" further.
|
344 |
+
The number of centers (5x,10x etc) allow more "tuning points" to further customize how the model reasons so to speak.
|
345 |
+
|
346 |
+
The core aim of this process is to increase the model's detail, concept and connection to the "world",
|
347 |
+
general concept connections, prose quality and prose length without affecting instruction following.
|
348 |
+
|
349 |
+
This will also enhance any creative use case(s) of any kind, including "brainstorming", creative art form(s) and like case uses.
|
350 |
+
|
351 |
+
Here are some of the enhancements this process brings to the model's performance:
|
352 |
+
|
353 |
+
- Prose generation seems more focused on the moment to moment.
|
354 |
+
- Sometimes there will be "preamble" and/or foreshadowing present.
|
355 |
+
- Fewer or no "cliches"
|
356 |
+
- Better overall prose and/or more complex / nuanced prose.
|
357 |
+
- A greater sense of nuance on all levels.
|
358 |
+
- Coherence is stronger.
|
359 |
+
- Description is more detailed, and connected closer to the content.
|
360 |
+
- Simile and Metaphors are stronger and better connected to the prose, story, and character.
|
361 |
+
- Sense of "there" / in the moment is enhanced.
|
362 |
+
- Details are more vivid, and there are more of them.
|
363 |
+
- Prose generation length can be long to extreme.
|
364 |
+
- Emotional engagement is stronger.
|
365 |
+
- The model will take FEWER liberties vs a normal model: It will follow directives more closely but will "guess" less.
|
366 |
+
- The MORE instructions and/or details you provide the more strongly the model will respond.
|
367 |
+
- Depending on the model "voice" may be more "human" vs original model's "voice".
|
368 |
+
|
369 |
+
Other "lab" observations:
|
370 |
+
|
371 |
+
- This process does not, in my opinion, make the model 5x or 10x "smarter" - if only that was true!
|
372 |
+
- However, a change in "IQ" was not an issue / a priority, and was not tested or calibrated for so to speak.
|
373 |
+
- From lab testing it seems to ponder, and consider more carefully roughly speaking.
|
374 |
+
- You could say this process sharpens the model's focus on it's task(s) at a deeper level.
|
375 |
+
|
376 |
+
The process to modify the model occurs at the root level - source files level. The model can quanted as a GGUF, EXL2, AWQ etc etc.
|
377 |
+
|
378 |
+
---
|
config.json
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"Qwen3MoeForCausalLM"
|
4 |
+
],
|
5 |
+
"attention_bias": false,
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"decoder_sparse_step": 1,
|
8 |
+
"eos_token_id": 151645,
|
9 |
+
"head_dim": 128,
|
10 |
+
"hidden_act": "silu",
|
11 |
+
"hidden_size": 2048,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 5472,
|
14 |
+
"max_position_embeddings": 524288,
|
15 |
+
"max_window_layers": 28,
|
16 |
+
"mlp_only_layers": [],
|
17 |
+
"model_type": "qwen3_moe",
|
18 |
+
"moe_intermediate_size": 768,
|
19 |
+
"norm_topk_prob": true,
|
20 |
+
"num_attention_heads": 32,
|
21 |
+
"num_experts": 128,
|
22 |
+
"num_experts_per_tok": 8,
|
23 |
+
"num_hidden_layers": 67,
|
24 |
+
"num_key_value_heads": 4,
|
25 |
+
"output_router_logits": false,
|
26 |
+
"qkv_bias": false,
|
27 |
+
"rms_norm_eps": 1e-06,
|
28 |
+
"rope_scaling": {
|
29 |
+
"type": "yarn",
|
30 |
+
"factor": 2.0,
|
31 |
+
"original_max_position_embeddings": 262144
|
32 |
+
},
|
33 |
+
"rope_theta": 10000000,
|
34 |
+
"router_aux_loss_coef": 0.0,
|
35 |
+
"shared_expert_intermediate_size": 0,
|
36 |
+
"sliding_window": null,
|
37 |
+
"tie_word_embeddings": false,
|
38 |
+
"torch_dtype": "bfloat16",
|
39 |
+
"transformers_version": "4.52.0.dev0",
|
40 |
+
"use_cache": true,
|
41 |
+
"use_qk_norm": true,
|
42 |
+
"use_sliding_window": false,
|
43 |
+
"vocab_size": 151936
|
44 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model-00001-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b4b94522af4135d6ff562f265448a4c14a6f82f542bae8c7e94dbd7d7c51051
|
3 |
+
size 4999262968
|
model-00002-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0cba4a221e9de72b6ff676a6d7e32ff8b4403c643b8592c565cb17dcd501e6e2
|
3 |
+
size 4997743192
|
model-00003-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3767cf463634aca22ea85403943d45d63a7ba6760d9cf6f4ad7cf3230d6dde98
|
3 |
+
size 4997743200
|
model-00004-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a90c18fd89f9c66b874d9f1248c3eebac2256fe9b1f464cd8f5ebca0008cfc33
|
3 |
+
size 4997742808
|
model-00005-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:525cc112517368e339928063ff46ed7a93594b19022f862c55d009efb6759478
|
3 |
+
size 4997743200
|
model-00006-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:65286f3cdef5b083c1f5846ab405d3b9bd31aa5c11a9841617aaae629f8edd9e
|
3 |
+
size 4997743176
|
model-00007-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:912253bb49c53d878ac4bddf4c2a5a90a1e80c283deae09e85cd30d6c228d65c
|
3 |
+
size 4997742832
|
model-00008-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:17b9d4ac1adf9509f85af3f47fe126bffc59282b5613a3857417ff07ed6e9c12
|
3 |
+
size 4997743200
|
model-00009-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:473a098324735dc340e1ced499b9cdb3389232222b910e09ee22b90781bba71a
|
3 |
+
size 4997742808
|
model-00010-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:78167fe2e718c56486176a2fc8c1d60dc7b1756b759ede2a0d462aa0cbf10f0f
|
3 |
+
size 4997743200
|
model-00011-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ab449591792217d67ac28c8fc30fd966ac5ca5d7ead4762721d512131444e158
|
3 |
+
size 4997290688
|
model-00012-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d627720c9280c8a02a1334b767cf160159cf3182ee0b90bc20b89632a2d09081
|
3 |
+
size 4998760112
|
model-00013-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6be47eec1d3fca972d6c8a4748b4228b0f0b03f450f2a19e903f8db105b020b3
|
3 |
+
size 4998758568
|
model-00014-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6015abcfd8d45f30b7ce74ee456d46e443442272526d8e6f2a5a18775ed45812
|
3 |
+
size 4998758512
|
model-00015-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dae0a69da5bed694ab720706d62cff623c59dda9b56672425159aa207bd2a7e0
|
3 |
+
size 4998758568
|
model-00016-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4e1093693c53ef635e06b22b78f99fbeb901266bbb167c1a5594f26a53604c5c
|
3 |
+
size 4997278176
|
model-00017-of-00017.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:842f3ead02c8283d83c86fb4f8b578a685fd091a1a145ddc171a62352f97d349
|
3 |
+
size 4777531960
|
model.safetensors.index.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
qwen3-total-recall.gif
ADDED
![]() |
Git LFS Details
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_prefix_space": false,
|
3 |
+
"added_tokens_decoder": {
|
4 |
+
"151643": {
|
5 |
+
"content": "<|endoftext|>",
|
6 |
+
"lstrip": false,
|
7 |
+
"normalized": false,
|
8 |
+
"rstrip": false,
|
9 |
+
"single_word": false,
|
10 |
+
"special": true
|
11 |
+
},
|
12 |
+
"151644": {
|
13 |
+
"content": "<|im_start|>",
|
14 |
+
"lstrip": false,
|
15 |
+
"normalized": false,
|
16 |
+
"rstrip": false,
|
17 |
+
"single_word": false,
|
18 |
+
"special": true
|
19 |
+
},
|
20 |
+
"151645": {
|
21 |
+
"content": "<|im_end|>",
|
22 |
+
"lstrip": false,
|
23 |
+
"normalized": false,
|
24 |
+
"rstrip": false,
|
25 |
+
"single_word": false,
|
26 |
+
"special": true
|
27 |
+
},
|
28 |
+
"151646": {
|
29 |
+
"content": "<|object_ref_start|>",
|
30 |
+
"lstrip": false,
|
31 |
+
"normalized": false,
|
32 |
+
"rstrip": false,
|
33 |
+
"single_word": false,
|
34 |
+
"special": true
|
35 |
+
},
|
36 |
+
"151647": {
|
37 |
+
"content": "<|object_ref_end|>",
|
38 |
+
"lstrip": false,
|
39 |
+
"normalized": false,
|
40 |
+
"rstrip": false,
|
41 |
+
"single_word": false,
|
42 |
+
"special": true
|
43 |
+
},
|
44 |
+
"151648": {
|
45 |
+
"content": "<|box_start|>",
|
46 |
+
"lstrip": false,
|
47 |
+
"normalized": false,
|
48 |
+
"rstrip": false,
|
49 |
+
"single_word": false,
|
50 |
+
"special": true
|
51 |
+
},
|
52 |
+
"151649": {
|
53 |
+
"content": "<|box_end|>",
|
54 |
+
"lstrip": false,
|
55 |
+
"normalized": false,
|
56 |
+
"rstrip": false,
|
57 |
+
"single_word": false,
|
58 |
+
"special": true
|
59 |
+
},
|
60 |
+
"151650": {
|
61 |
+
"content": "<|quad_start|>",
|
62 |
+
"lstrip": false,
|
63 |
+
"normalized": false,
|
64 |
+
"rstrip": false,
|
65 |
+
"single_word": false,
|
66 |
+
"special": true
|
67 |
+
},
|
68 |
+
"151651": {
|
69 |
+
"content": "<|quad_end|>",
|
70 |
+
"lstrip": false,
|
71 |
+
"normalized": false,
|
72 |
+
"rstrip": false,
|
73 |
+
"single_word": false,
|
74 |
+
"special": true
|
75 |
+
},
|
76 |
+
"151652": {
|
77 |
+
"content": "<|vision_start|>",
|
78 |
+
"lstrip": false,
|
79 |
+
"normalized": false,
|
80 |
+
"rstrip": false,
|
81 |
+
"single_word": false,
|
82 |
+
"special": true
|
83 |
+
},
|
84 |
+
"151653": {
|
85 |
+
"content": "<|vision_end|>",
|
86 |
+
"lstrip": false,
|
87 |
+
"normalized": false,
|
88 |
+
"rstrip": false,
|
89 |
+
"single_word": false,
|
90 |
+
"special": true
|
91 |
+
},
|
92 |
+
"151654": {
|
93 |
+
"content": "<|vision_pad|>",
|
94 |
+
"lstrip": false,
|
95 |
+
"normalized": false,
|
96 |
+
"rstrip": false,
|
97 |
+
"single_word": false,
|
98 |
+
"special": true
|
99 |
+
},
|
100 |
+
"151655": {
|
101 |
+
"content": "<|image_pad|>",
|
102 |
+
"lstrip": false,
|
103 |
+
"normalized": false,
|
104 |
+
"rstrip": false,
|
105 |
+
"single_word": false,
|
106 |
+
"special": true
|
107 |
+
},
|
108 |
+
"151656": {
|
109 |
+
"content": "<|video_pad|>",
|
110 |
+
"lstrip": false,
|
111 |
+
"normalized": false,
|
112 |
+
"rstrip": false,
|
113 |
+
"single_word": false,
|
114 |
+
"special": true
|
115 |
+
},
|
116 |
+
"151657": {
|
117 |
+
"content": "<tool_call>",
|
118 |
+
"lstrip": false,
|
119 |
+
"normalized": false,
|
120 |
+
"rstrip": false,
|
121 |
+
"single_word": false,
|
122 |
+
"special": false
|
123 |
+
},
|
124 |
+
"151658": {
|
125 |
+
"content": "</tool_call>",
|
126 |
+
"lstrip": false,
|
127 |
+
"normalized": false,
|
128 |
+
"rstrip": false,
|
129 |
+
"single_word": false,
|
130 |
+
"special": false
|
131 |
+
},
|
132 |
+
"151659": {
|
133 |
+
"content": "<|fim_prefix|>",
|
134 |
+
"lstrip": false,
|
135 |
+
"normalized": false,
|
136 |
+
"rstrip": false,
|
137 |
+
"single_word": false,
|
138 |
+
"special": false
|
139 |
+
},
|
140 |
+
"151660": {
|
141 |
+
"content": "<|fim_middle|>",
|
142 |
+
"lstrip": false,
|
143 |
+
"normalized": false,
|
144 |
+
"rstrip": false,
|
145 |
+
"single_word": false,
|
146 |
+
"special": false
|
147 |
+
},
|
148 |
+
"151661": {
|
149 |
+
"content": "<|fim_suffix|>",
|
150 |
+
"lstrip": false,
|
151 |
+
"normalized": false,
|
152 |
+
"rstrip": false,
|
153 |
+
"single_word": false,
|
154 |
+
"special": false
|
155 |
+
},
|
156 |
+
"151662": {
|
157 |
+
"content": "<|fim_pad|>",
|
158 |
+
"lstrip": false,
|
159 |
+
"normalized": false,
|
160 |
+
"rstrip": false,
|
161 |
+
"single_word": false,
|
162 |
+
"special": false
|
163 |
+
},
|
164 |
+
"151663": {
|
165 |
+
"content": "<|repo_name|>",
|
166 |
+
"lstrip": false,
|
167 |
+
"normalized": false,
|
168 |
+
"rstrip": false,
|
169 |
+
"single_word": false,
|
170 |
+
"special": false
|
171 |
+
},
|
172 |
+
"151664": {
|
173 |
+
"content": "<|file_sep|>",
|
174 |
+
"lstrip": false,
|
175 |
+
"normalized": false,
|
176 |
+
"rstrip": false,
|
177 |
+
"single_word": false,
|
178 |
+
"special": false
|
179 |
+
},
|
180 |
+
"151665": {
|
181 |
+
"content": "<tool_response>",
|
182 |
+
"lstrip": false,
|
183 |
+
"normalized": false,
|
184 |
+
"rstrip": false,
|
185 |
+
"single_word": false,
|
186 |
+
"special": false
|
187 |
+
},
|
188 |
+
"151666": {
|
189 |
+
"content": "</tool_response>",
|
190 |
+
"lstrip": false,
|
191 |
+
"normalized": false,
|
192 |
+
"rstrip": false,
|
193 |
+
"single_word": false,
|
194 |
+
"special": false
|
195 |
+
},
|
196 |
+
"151667": {
|
197 |
+
"content": "<think>",
|
198 |
+
"lstrip": false,
|
199 |
+
"normalized": false,
|
200 |
+
"rstrip": false,
|
201 |
+
"single_word": false,
|
202 |
+
"special": false
|
203 |
+
},
|
204 |
+
"151668": {
|
205 |
+
"content": "</think>",
|
206 |
+
"lstrip": false,
|
207 |
+
"normalized": false,
|
208 |
+
"rstrip": false,
|
209 |
+
"single_word": false,
|
210 |
+
"special": false
|
211 |
+
}
|
212 |
+
},
|
213 |
+
"additional_special_tokens": [
|
214 |
+
"<|im_start|>",
|
215 |
+
"<|im_end|>",
|
216 |
+
"<|object_ref_start|>",
|
217 |
+
"<|object_ref_end|>",
|
218 |
+
"<|box_start|>",
|
219 |
+
"<|box_end|>",
|
220 |
+
"<|quad_start|>",
|
221 |
+
"<|quad_end|>",
|
222 |
+
"<|vision_start|>",
|
223 |
+
"<|vision_end|>",
|
224 |
+
"<|vision_pad|>",
|
225 |
+
"<|image_pad|>",
|
226 |
+
"<|video_pad|>"
|
227 |
+
],
|
228 |
+
"bos_token": null,
|
229 |
+
"chat_template": "{% macro render_item_list(item_list, tag_name='required') %}\n {%- if item_list is defined and item_list is iterable and item_list | length > 0 %}\n {%- if tag_name %}{{- '\\n<' ~ tag_name ~ '>' -}}{% endif %}\n {{- '[' }}\n {%- for item in item_list -%}\n {%- if loop.index > 1 %}{{- \", \"}}{% endif -%}\n {%- if item is string -%}\n {{ \"`\" ~ item ~ \"`\" }}\n {%- else -%}\n {{ item }}\n {%- endif -%}\n {%- endfor -%}\n {{- ']' }}\n {%- if tag_name %}{{- '</' ~ tag_name ~ '>' -}}{% endif %}\n {%- endif %}\n{% endmacro %}\n\n{%- if messages[0][\"role\"] == \"system\" %}\n {%- set system_message = messages[0][\"content\"] %}\n {%- set loop_messages = messages[1:] %}\n{%- else %}\n {%- set loop_messages = messages %}\n{%- endif %}\n\n{%- if not tools is defined %}\n {%- set tools = [] %}\n{%- endif %}\n\n{%- if system_message is defined %}\n {{- \"<|im_start|>system\\n\" + system_message }}\n{%- else %}\n {%- if tools is iterable and tools | length > 0 %}\n {{- \"<|im_start|>system\\nYou are Qwen, a helpful AI assistant that can interact with a computer to solve tasks.\" }}\n {%- endif %}\n{%- endif %}\n{%- if tools is iterable and tools | length > 0 %}\n {{- \"\\n\\nYou have access to the following functions:\\n\\n\" }}\n {{- \"<tools>\" }}\n {%- for tool in tools %}\n {%- if tool.function is defined %}\n {%- set tool = tool.function %}\n {%- endif %}\n {{- \"\\n<function>\\n<name>\" ~ tool.name ~ \"</name>\" }}\n {{- '\\n<description>' ~ (tool.description | trim) ~ '</description>' }}\n {{- '\\n<parameters>' }}\n {%- for param_name, param_fields in tool.parameters.properties|items %}\n {{- '\\n<parameter>' }}\n {{- '\\n<name>' ~ param_name ~ '</name>' }}\n {%- if param_fields.type is defined %}\n {{- '\\n<type>' ~ (param_fields.type | string) ~ '</type>' }}\n {%- endif %}\n {%- if param_fields.description is defined %}\n {{- '\\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}\n {%- endif %}\n {{- render_item_list(param_fields.enum, 'enum') }}\n {%- set handled_keys = ['type', 'description', 'enum', 'required'] %}\n {%- for json_key in param_fields.keys() | reject(\"in\", handled_keys) %}\n {%- set normed_json_key = json_key | replace(\"-\", \"_\") | replace(\" \", \"_\") | replace(\"$\", \"\") %}\n {%- if param_fields[json_key] is mapping %}\n {{- '\\n<' ~ normed_json_key ~ '>' ~ (param_fields[json_key] | tojson | safe) ~ '</' ~ normed_json_key ~ '>' }}\n {%- else %}\n {{-'\\n<' ~ normed_json_key ~ '>' ~ (param_fields[json_key] | string) ~ '</' ~ normed_json_key ~ '>' }}\n {%- endif %}\n {%- endfor %}\n {{- render_item_list(param_fields.required, 'required') }}\n {{- '\\n</parameter>' }}\n {%- endfor %}\n {{- render_item_list(tool.parameters.required, 'required') }}\n {{- '\\n</parameters>' }}\n {%- if tool.return is defined %}\n {%- if tool.return is mapping %}\n {{- '\\n<return>' ~ (tool.return | tojson | safe) ~ '</return>' }}\n {%- else %}\n {{- '\\n<return>' ~ (tool.return | string) ~ '</return>' }}\n {%- endif %}\n {%- endif %}\n {{- '\\n</function>' }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n{%- endif %}\n{%- if system_message is defined %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if tools is iterable and tools | length > 0 %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in loop_messages %}\n {%- if message.role == \"assistant\" and message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content is defined and message.content is string and message.content | trim | length > 0 %}\n {{- '\\n' + message.content | trim + '\\n' }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value if args_value is string else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"user\" or message.role == \"system\" or message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user\\n' }}\n {%- endif %}\n {{- '<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>\\n' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
|
230 |
+
"clean_up_tokenization_spaces": false,
|
231 |
+
"eos_token": "<|im_end|>",
|
232 |
+
"errors": "replace",
|
233 |
+
"model_max_length": 1048576,
|
234 |
+
"pad_token": "<|endoftext|>",
|
235 |
+
"split_special_tokens": false,
|
236 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
237 |
+
"unk_token": null,
|
238 |
+
"add_bos_token": false
|
239 |
+
}
|