DavidAU commited on
Commit
6f0cc70
·
verified ·
1 Parent(s): 3ca5b3c

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +425 -0
README.md ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ datasets:
5
+ - DavidAU/PKDick-Dataset
6
+ language:
7
+ - en
8
+ - fr
9
+ - zh
10
+ - de
11
+ tags:
12
+ - programming
13
+ - code generation
14
+ - code
15
+ - codeqwen
16
+ - programming
17
+ - code generation
18
+ - code
19
+ - codeqwen
20
+ - moe
21
+ - coding
22
+ - coder
23
+ - qwen2
24
+ - chat
25
+ - qwen
26
+ - qwen-coder
27
+ - chat
28
+ - qwen
29
+ - qwen-coder
30
+ - moe
31
+ - Qwen3-Coder-30B-A3B-Instruct
32
+ - Qwen3-30B-A3B
33
+ - mixture of experts
34
+ - 128 experts
35
+ - 8 active experts
36
+ - 1 million context
37
+ - qwen3
38
+ - finetune
39
+ - brainstorm 20x
40
+ - brainstorm
41
+ - optional thinking
42
+ - qwen3_moe
43
+ - unsloth
44
+ base_model:
45
+ - YOYO-AI/Qwen3-30B-A3B-YOYO-V4
46
+ pipeline_tag: text-generation
47
+ ---
48
+
49
+ <h2>Qwen3-Yoyo-V4-42B-A3B-Thinking-TOTAL-RECALL-PDK-V [1 million context]</h2>
50
+
51
+ <img src="qwen3-total-recall.gif" style="float:right; width:300px; height:300px; padding:10px;">
52
+
53
+ This repo contains the full precision source code, in "safe tensors" format to generate GGUFs, GPTQ, EXL2, AWQ, HQQ and other formats.
54
+ The source code can also be used directly.
55
+
56
+ ---
57
+
58
+ EXPERIMENTAL:
59
+
60
+ This is a limited fine tune (selected layers, experimental methods) on FIVE inhouse datasets (of PK Dick - whose works were
61
+ the basis for "Total Recall") using Unsloth. This will add some "his unique point of view" to the model.
62
+
63
+ NOTE: Due to training levels, thinking may not "activate" or be "irregular" in this model.
64
+
65
+ This version has STRONGER training, with more depth than TNG-III (and I and II) using different training method.
66
+
67
+ This model (and other TNG Yoyo versions) excel at both coding and creative.
68
+
69
+ I suggest you try all FOUR (Yoyo V3 - 3 versions, Yoyo V4 - one version) versions to see which meets your use case(s) better.
70
+
71
+ Completely mad science.
72
+
73
+ Suggest 8-10 experts, temp .7 ish, rep pen 1.05 to 1.1 ; quants at least Q4.
74
+
75
+ ---
76
+
77
+ This model is for CODING and programming in all major programming languages and many minor ones too AND GENERAL USAGE.
78
+
79
+ This model is based on Qwen3-Coder-30B-A3B-Instruct (MOE, 128 experts, 8 activated), with Brainstorm 20X
80
+ (by DavidAU) - details at bottom of this page.
81
+
82
+ This model is a result of merged model (3 step, 3 models) from:
83
+
84
+ https://huggingface.co/YOYO-AI/Qwen3-30B-A3B-YOYO-V4
85
+
86
+ (you may want to visit this repo for settings/info too)
87
+
88
+ The Brainstorm adapter will improve general performance and "out of the box" thinking.
89
+
90
+ This creates a model of 42B parameters, 67 layers and 807 tensors.
91
+
92
+ This version has the NATIVE context of 1 million context.
93
+
94
+ This is a thinking block model.
95
+
96
+ I have included an optional system prompt to invoke "thinking" in this model, if you want to activate it.
97
+
98
+ SETTINGS:
99
+
100
+ For coding, programming set expert to:
101
+ - 6-8 for general work.
102
+ - 10 for moderate work.
103
+ - 12-16 for complex work, long projects, complex coding.
104
+ - Suggest min context window 4k to 8k.
105
+ - And for longer context, and/or multi-turn -> increase experts by 1-2 to help with longer context/multi turn understanding.
106
+
107
+ Recommended settings - general:
108
+ - 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)
109
+ - Temp .3 to .6 (+- .2)
110
+ - Topk of 20, 40 or 100
111
+ - Topp of .95 / min p of .05
112
+ - Suggest min context window 4k to 8k.
113
+ - System prompt (optional) to focus the model better.
114
+
115
+ This is the refined version -V1.4- from this project (see this repo for all settings, details, system prompts, example generations etc etc):
116
+
117
+ https://huggingface.co/DavidAU/Qwen3-55B-A3B-TOTAL-RECALL-Deep-40X-GGUF/
118
+
119
+ This version 2 is slightly smaller, with further refinements to the Brainstorm adapter and uses the new "Qwen3-30B-A3B-Instruct-2507".
120
+
121
+ Review and Specialized Settings for this model (V 1.4):
122
+
123
+ https://www.linkedin.com/posts/gchesler_davidauqwen3-53b-a3b-total-recall-v14-128k-activity-7344938636141858816-ILCM/
124
+
125
+ https://www.linkedin.com/posts/gchesler_haskell-postgres-agentic-activity-7347103276141596672-_zbo/
126
+
127
+ You may also want to see (root model of Total Recall series - Version 1):
128
+
129
+ https://huggingface.co/Qwen/Qwen3-30B-A3B
130
+
131
+ AND Version 2 root model:
132
+
133
+ https://huggingface.co/Qwen/Qwen3-Coder-30B-A3B-Instruct
134
+
135
+ For additional settings, tool use, and other model settings.
136
+
137
+ Summary of root model below, followed by FULL HELP SECTION, then info on Brainstorm 40x.
138
+
139
+ OPTIONAL SYSTEM PROMPT - INVOKE "Thinking":
140
+
141
+ ```
142
+ 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.
143
+ ```
144
+
145
+ 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.
146
+
147
+ 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.
148
+
149
+ If you change "ponder" to a different word/phrase this will affect model "thinking" too.
150
+
151
+ ---
152
+
153
+ QUANTS
154
+
155
+ ---
156
+
157
+ GGUF? GGUF Imatrix? Other?
158
+
159
+ Special thanks to Team Mradermacher, Team Nightmedia and other quanters!
160
+
161
+ See under "model tree", upper right and click on "quantizations".
162
+
163
+ New quants will automatically appear.
164
+
165
+ ---
166
+
167
+ # Qwen3-Coder-3B-A3B-Instruct
168
+
169
+ ## Highlights
170
+
171
+ **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:
172
+
173
+ - **Significant Performance** among open models on **Agentic Coding**, **Agentic Browser-Use**, and other foundational coding tasks.
174
+ - **Long-context Capabilities** with native support for **256K** tokens, extendable up to **1M** tokens using Yarn, optimized for repository-scale understanding.
175
+ - **Agentic Coding** supporting for most platform such as **Qwen Code**, **CLINE**, featuring a specially designed function call format.
176
+
177
+ ![image/jpeg](https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen3-Coder/qwen3-coder-30a3-main.jpg)
178
+
179
+ ## Model Overview
180
+
181
+ **Qwen3-Coder-30B-A3B-Instruct** has the following features:
182
+ - Type: Causal Language Models
183
+ - Training Stage: Pretraining & Post-training
184
+ - Number of Parameters: 30.5B in total and 3.3B activated
185
+ - Number of Layers: 48
186
+ - Number of Attention Heads (GQA): 32 for Q and 4 for KV
187
+ - Number of Experts: 128
188
+ - Number of Activated Experts: 8
189
+ - Context Length: **262,144 natively**.
190
+
191
+ **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.**
192
+
193
+ 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/).
194
+
195
+
196
+ ## Quickstart
197
+
198
+ We advise you to use the latest version of `transformers`.
199
+
200
+ With `transformers<4.51.0`, you will encounter the following error:
201
+ ```
202
+ KeyError: 'qwen3_moe'
203
+ ```
204
+
205
+ The following contains a code snippet illustrating how to use the model generate content based on given inputs.
206
+ ```python
207
+ from transformers import AutoModelForCausalLM, AutoTokenizer
208
+
209
+ model_name = "Qwen/Qwen3-Coder-30B-A3B-Instruct"
210
+
211
+ # load the tokenizer and the model
212
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
213
+ model = AutoModelForCausalLM.from_pretrained(
214
+ model_name,
215
+ torch_dtype="auto",
216
+ device_map="auto"
217
+ )
218
+
219
+ # prepare the model input
220
+ prompt = "Write a quick sort algorithm."
221
+ messages = [
222
+ {"role": "user", "content": prompt}
223
+ ]
224
+ text = tokenizer.apply_chat_template(
225
+ messages,
226
+ tokenize=False,
227
+ add_generation_prompt=True,
228
+ )
229
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
230
+
231
+ # conduct text completion
232
+ generated_ids = model.generate(
233
+ **model_inputs,
234
+ max_new_tokens=65536
235
+ )
236
+ output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
237
+
238
+ content = tokenizer.decode(output_ids, skip_special_tokens=True)
239
+
240
+ print("content:", content)
241
+ ```
242
+
243
+ **Note: If you encounter out-of-memory (OOM) issues, consider reducing the context length to a shorter value, such as `32,768`.**
244
+
245
+ For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.
246
+
247
+ ## Agentic Coding
248
+
249
+ Qwen3-Coder excels in tool calling capabilities.
250
+
251
+ You can simply define or use any tools as following example.
252
+ ```python
253
+ # Your tool implementation
254
+ def square_the_number(num: float) -> dict:
255
+ return num ** 2
256
+
257
+ # Define Tools
258
+ tools=[
259
+ {
260
+ "type":"function",
261
+ "function":{
262
+ "name": "square_the_number",
263
+ "description": "output the square of the number.",
264
+ "parameters": {
265
+ "type": "object",
266
+ "required": ["input_num"],
267
+ "properties": {
268
+ 'input_num': {
269
+ 'type': 'number',
270
+ 'description': 'input_num is a number that will be squared'
271
+ }
272
+ },
273
+ }
274
+ }
275
+ }
276
+ ]
277
+
278
+ import OpenAI
279
+ # Define LLM
280
+ client = OpenAI(
281
+ # Use a custom endpoint compatible with OpenAI API
282
+ base_url='http://localhost:8000/v1', # api_base
283
+ api_key="EMPTY"
284
+ )
285
+
286
+ messages = [{'role': 'user', 'content': 'square the number 1024'}]
287
+
288
+ completion = client.chat.completions.create(
289
+ messages=messages,
290
+ model="Qwen3-Coder-30B-A3B-Instruct",
291
+ max_tokens=65536,
292
+ tools=tools,
293
+ )
294
+
295
+ print(completion.choice[0])
296
+ ```
297
+
298
+ ## Best Practices
299
+
300
+ To achieve optimal performance, we recommend the following settings:
301
+
302
+ 1. **Sampling Parameters**:
303
+ - We suggest using `temperature=0.7`, `top_p=0.8`, `top_k=20`, `repetition_penalty=1.05`.
304
+
305
+ 2. **Adequate Output Length**: We recommend using an output length of 65,536 tokens for most queries, which is adequate for instruct models.
306
+
307
+ ---
308
+
309
+ <H2>Help, Adjustments, Samplers, Parameters and More</H2>
310
+
311
+ ---
312
+
313
+ <B>CHANGE THE NUMBER OF ACTIVE EXPERTS:</B>
314
+
315
+ See this document:
316
+
317
+ https://huggingface.co/DavidAU/How-To-Set-and-Manage-MOE-Mix-of-Experts-Model-Activation-of-Experts
318
+
319
+ <B>Settings: CHAT / ROLEPLAY and/or SMOOTHER operation of this model:</B>
320
+
321
+ In "KoboldCpp" or "oobabooga/text-generation-webui" or "Silly Tavern" ;
322
+
323
+ Set the "Smoothing_factor" to 1.5
324
+
325
+ : in KoboldCpp -> Settings->Samplers->Advanced-> "Smooth_F"
326
+
327
+ : in text-generation-webui -> parameters -> lower right.
328
+
329
+ : In Silly Tavern this is called: "Smoothing"
330
+
331
+
332
+ NOTE: For "text-generation-webui"
333
+
334
+ -> if using GGUFs you need to use "llama_HF" (which involves downloading some config files from the SOURCE version of this model)
335
+
336
+ Source versions (and config files) of my models are here:
337
+
338
+ https://huggingface.co/collections/DavidAU/d-au-source-files-for-gguf-exl2-awq-gptq-hqq-etc-etc-66b55cb8ba25f914cbf210be
339
+
340
+ OTHER OPTIONS:
341
+
342
+ - Increase rep pen to 1.1 to 1.15 (you don't need to do this if you use "smoothing_factor")
343
+
344
+ - If the interface/program you are using to run AI MODELS supports "Quadratic Sampling" ("smoothing") just make the adjustment as noted.
345
+
346
+ <B>Highest Quality Settings / Optimal Operation Guide / Parameters and Samplers</B>
347
+
348
+ This a "Class 1" model:
349
+
350
+ 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:
351
+
352
+ [ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]
353
+
354
+ You can see all parameters used for generation, in addition to advanced parameters and samplers to get the most out of this model here:
355
+
356
+ [ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]
357
+
358
+ ---
359
+
360
+ <H2>What is Brainstorm?</H2>
361
+
362
+ ---
363
+
364
+ <B>Brainstorm 20x</B>
365
+
366
+ The BRAINSTORM process was developed by David_AU.
367
+
368
+ Some of the core principals behind this process are discussed in this <a href="https://arxiv.org/pdf/2401.02415">
369
+ scientific paper : Progressive LLaMA with Block Expansion </a>.
370
+
371
+ However I went in a completely different direction from what was outlined in this paper.
372
+
373
+ What is "Brainstorm" ?
374
+
375
+ The reasoning center of an LLM is taken apart, reassembled, and expanded.
376
+
377
+ In this case for this model: 20 times
378
+
379
+ Then these centers are individually calibrated. These "centers" also interact with each other.
380
+ This introduces subtle changes into the reasoning process.
381
+ The calibrations further adjust - dial up or down - these "changes" further.
382
+ The number of centers (5x,10x etc) allow more "tuning points" to further customize how the model reasons so to speak.
383
+
384
+ The core aim of this process is to increase the model's detail, concept and connection to the "world",
385
+ general concept connections, prose quality and prose length without affecting instruction following.
386
+
387
+ This will also enhance any creative use case(s) of any kind, including "brainstorming", creative art form(s) and like case uses.
388
+
389
+ Here are some of the enhancements this process brings to the model's performance:
390
+
391
+ - Prose generation seems more focused on the moment to moment.
392
+ - Sometimes there will be "preamble" and/or foreshadowing present.
393
+ - Fewer or no "cliches"
394
+ - Better overall prose and/or more complex / nuanced prose.
395
+ - A greater sense of nuance on all levels.
396
+ - Coherence is stronger.
397
+ - Description is more detailed, and connected closer to the content.
398
+ - Simile and Metaphors are stronger and better connected to the prose, story, and character.
399
+ - Sense of "there" / in the moment is enhanced.
400
+ - Details are more vivid, and there are more of them.
401
+ - Prose generation length can be long to extreme.
402
+ - Emotional engagement is stronger.
403
+ - The model will take FEWER liberties vs a normal model: It will follow directives more closely but will "guess" less.
404
+ - The MORE instructions and/or details you provide the more strongly the model will respond.
405
+ - Depending on the model "voice" may be more "human" vs original model's "voice".
406
+
407
+ Other "lab" observations:
408
+
409
+ - This process does not, in my opinion, make the model 5x or 10x "smarter" - if only that was true!
410
+ - However, a change in "IQ" was not an issue / a priority, and was not tested or calibrated for so to speak.
411
+ - From lab testing it seems to ponder, and consider more carefully roughly speaking.
412
+ - You could say this process sharpens the model's focus on it's task(s) at a deeper level.
413
+
414
+ 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.
415
+
416
+ ---
417
+
418
+ EXAMPLES
419
+
420
+ Using GGUF Q4KS, This is mid-quality quant.
421
+
422
+ 8 Experts activated for generation.
423
+
424
+ ---
425
+