DavidAU commited on
Commit
3a6c7ab
·
verified ·
1 Parent(s): eeaab47

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +351 -0
README.md ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - microsoft/NextCoder-14B
5
+ - Qwen/Qwen2.5-Coder-14B-Instruct
6
+ language:
7
+ - en
8
+ pipeline_tag: text-generation
9
+ tags:
10
+ - merge
11
+ - programming
12
+ - code generation
13
+ - code
14
+ - codeqwen
15
+ - coding
16
+ - coder
17
+ - qwen2
18
+ - chat
19
+ - qwen
20
+ - qwen-coder
21
+ - code
22
+ - chat
23
+ - microsoft
24
+ - nextcoder
25
+ - selekt
26
+ datasets:
27
+ - microsoft/NextCoderDataset
28
+ - microsoft/NextCoderDataset-Conversational
29
+ - bigcode/commitpackft
30
+ - bigcode/starcoderdata
31
+ library_name: transformers
32
+ ---
33
+
34
+ <h2>Qwen2.5-Microsoft-NextCoder-Instruct-FUSED-CODER-Fast-22B</h2>
35
+
36
+ This repo contains the full precision source code, in "safe tensors" format to generate GGUFs, GPTQ, EXL2, AWQ, HQQ and other formats.
37
+ The source code can also be used directly.
38
+
39
+ This model contains Qwen 14b Coder Instruct FUSED with Microsoft's 14B Coder (instruct model) creating an 22B, 73 layers, 879 tensors model.
40
+
41
+ https://huggingface.co/Qwen/Qwen2.5-Coder-14B-Instruct
42
+
43
+ https://huggingface.co/microsoft/NextCoder-14B
44
+
45
+ Information on the models below, and then a complete help section for running LLM / AI models.
46
+
47
+ The FUSING process enhances model performance and the model has minimal to no "reasoning" blocks.
48
+
49
+ Ask the model for code, and you get code asap.
50
+
51
+ Source is in float32 precision to preserve Microsoft Next Coder's 32 bit source.
52
+
53
+ This model requires:
54
+ - Jinja (embedded) or CHATML template
55
+ - Max context of 32k expanded as per Qwen2.5 methods.
56
+
57
+ Settings used for testing (suggested):
58
+ - Temp .3 to .7
59
+ - Rep pen 1.05 to 1.1
60
+ - Topp .8 , minp .05
61
+ - Topk 20
62
+ - No system prompt.
63
+
64
+ This model will respond well to both detailed instructions and step by step refinement and additions to code.
65
+
66
+ As this is an instruct model, it will also benefit from a detailed system prompt too.
67
+
68
+ For simpler coding problems, lower quants will work well; but for complex/multi-step problem solving suggest Q6 or Q8.
69
+
70
+ ---
71
+
72
+ # NextCoder-14B
73
+
74
+ ---
75
+
76
+ <p align="center">
77
+ <a href="https://github.com/microsoft/NextCoder">GitHub</a>&nbsp&nbsp | &nbsp&nbsp <a href="https://www.microsoft.com/en-us/research/publication/nextcoder-robust-adaptation-of-code-lms-to-diverse-code-edits/">Paper</a>
78
+ </p>
79
+
80
+ > NextCoder: Robust Adaptation of Code LMs to Diverse Code Edits (ICML'2025)
81
+
82
+ ## Introduction
83
+
84
+ NextCoder is the latest series of Code-Editing large language models developed using the Qwen2.5-Coder Instruct variants as base and trained with novel Selective Knowledge Transfer finetuning methodology as introduced in the paper. NextCoder family model comes in 3 different sizes 7, 14, 32 billion parameters, to meet the needs of different developers.
85
+ Following are the key improvements:
86
+ - Significantly improvements in **code editing**, NextCoder-32B has performing on par with GPT-4o on complex benchmarks like Aider-Polyglot with performance increment of 44% from their base model.
87
+ - No loss of generalizibility, due to our new finetuning method **SeleKT**
88
+ - **Long-context Support** up to 32K tokens.
89
+
90
+ **This repo contains the NextCoder 14B model**, which has the following features:
91
+ - Type: Causal Language Models
92
+ - Training Stage: Post-training with SeleKT
93
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
94
+ - Number of Parameters: 14.7B
95
+ - Number of Paramaters (Non-Embedding): 13.1B
96
+ - Number of Layers: 48
97
+ - Number of Attention Heads (GQA): 40 for Q and 8 for KV
98
+
99
+ For more details, please refer to our [blog](), [GitHub](https://github.com/microsoft/NextCoder), [Paper](https://www.microsoft.com/en-us/research/publication/nextcoder-robust-adaptation-of-code-lms-to-diverse-code-edits/).
100
+
101
+ ## Requirements
102
+
103
+ The code of NextCoder is based on Qwen2.5 base models which has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
104
+
105
+ With `transformers<4.37.0`, you will encounter the following error:
106
+ ```
107
+ KeyError: 'qwen2'
108
+ ```
109
+
110
+ ## Quickstart
111
+
112
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
113
+
114
+ ```python
115
+ from transformers import AutoModelForCausalLM, AutoTokenizer
116
+
117
+ model_name = "microsoft/NextCoder-14B"
118
+
119
+ model = AutoModelForCausalLM.from_pretrained(
120
+ model_name,
121
+ torch_dtype="auto",
122
+ device_map="auto",
123
+ )
124
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
125
+
126
+ prompt = """
127
+ Fix the following function that divides two numbers to handle all the edge cases:
128
+
129
+ def divide(a, b)
130
+ returm a/b
131
+ """
132
+ messages = [
133
+ {"role": "user", "content": prompt}
134
+ ]
135
+ text = tokenizer.apply_chat_template(
136
+ messages,
137
+ tokenize=False,
138
+ add_generation_prompt=True
139
+ )
140
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
141
+
142
+ generated_ids = model.generate(
143
+ **model_inputs,
144
+ max_new_tokens=1024
145
+ )
146
+ generated_ids = [
147
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
148
+ ]
149
+
150
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
151
+ ```
152
+ ## Evaluation and Performance
153
+
154
+ | Models | HUMANEVALFIX | CANITEDIT | AIDER | POLYGLOT |
155
+ |--------|---------------|-----------|-------|----------|
156
+ | QwenCoder-2.5-3B | 73.2 | 37.1 | 36.8 | - |
157
+ | QwenCoder-2.5-3B-LoRA | 64.6 | 36.2 | 35.8 | - |
158
+ | QwenCoder-2.5-3B-SFT | 76.2 | 32.4 | 30.1 | - |
159
+ | **NextCoder-3B** | 75.6 | 42.4 | 37.6 | - |
160
+ | QwenCoder-2.5-7B | 73.8 | 48.1 | 59.4 | - |
161
+ | QwenCoder-2.5-7B-LoRA | 70.7 | 44.3 | 40.6 | - |
162
+ | QwenCoder-2.5-7B-SFT | 70.1 | 36.7 | 48.9 | - |
163
+ | **NextCoder-7B** | 81.1 | 50.5 | 65.7 | - |
164
+ | QwenCoder-2.5-14B | 87.8 | 58.1 | 66.9 | 9.3 |
165
+ | QwenCoder-2.5-14B-LoRA | 78.0 | 50.9 | 66.2 | 5.3 |
166
+ | QwenCoder-2.5-14B-SFT | 79.9 | 42.4 | 36.8 | 3.1 |
167
+ | **NextCoder-14B** | 89.8 | 60.2 | 72.2 | 12.2 |
168
+ | QwenCoder-2.5-32B | **90.2** | 61.0 | 72.9 | 16.4 |
169
+ | QwenCoder-2.5-32B-LoRA | 82.3 | 52.4 | 60.2 | 6.7 |
170
+ | QwenCoder-2.5-32B-SFT | 81.7 | 49.5 | 66.9 | 8.4 |
171
+ | **NextCoder-32B** | 88.9 | **62.4** | **74.7** | **23.6** |
172
+
173
+ *Comparison of base QwenCoder-2.5 models of different sizes and their SELEKT-enhanced versions across three code editing benchmarks.*
174
+
175
+ **Detailed evaluation results are reported in this [📑 paper](https://www.microsoft.com/en-us/research/publication/nextcoder-robust-adaptation-of-code-lms-to-diverse-code-edits/).**
176
+
177
+ ## Responsible AI Use
178
+ The base models (from the QwenCoder-2.5 family) are suspectible to malicious prompts and may generate or execute harmful code. Our finetuning does not enhance or impede such behaviors. The users should use the models and their outputs responsibly and with caution. Model outputs should be subjected to additional analysis, including manual inspection, and sandboxing before execution.
179
+
180
+ See more here:
181
+
182
+ https://huggingface.co/microsoft/NextCoder-14B
183
+
184
+ ---
185
+
186
+ # Qwen2.5-Coder-14B-Instruct
187
+
188
+ ---
189
+
190
+ # Qwen2.5-Coder-14B-Instruct
191
+ <a href="https://chat.qwenlm.ai/" target="_blank" style="margin: 2px;">
192
+ <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
193
+ </a>
194
+
195
+ ## Introduction
196
+
197
+ Qwen2.5-Coder is the latest series of Code-Specific Qwen large language models (formerly known as CodeQwen). As of now, Qwen2.5-Coder has covered six mainstream model sizes, 0.5, 1.5, 3, 7, 14, 32 billion parameters, to meet the needs of different developers. Qwen2.5-Coder brings the following improvements upon CodeQwen1.5:
198
+
199
+ - Significantly improvements in **code generation**, **code reasoning** and **code fixing**. Base on the strong Qwen2.5, we scale up the training tokens into 5.5 trillion including source code, text-code grounding, Synthetic data, etc. Qwen2.5-Coder-32B has become the current state-of-the-art open-source codeLLM, with its coding abilities matching those of GPT-4o.
200
+ - A more comprehensive foundation for real-world applications such as **Code Agents**. Not only enhancing coding capabilities but also maintaining its strengths in mathematics and general competencies.
201
+ - **Long-context Support** up to 128K tokens.
202
+
203
+ **This repo contains the instruction-tuned 14B Qwen2.5-Coder model**, which has the following features:
204
+ - Type: Causal Language Models
205
+ - Training Stage: Pretraining & Post-training
206
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
207
+ - Number of Parameters: 14.7B
208
+ - Number of Paramaters (Non-Embedding): 13.1B
209
+ - Number of Layers: 48
210
+ - Number of Attention Heads (GQA): 40 for Q and 8 for KV
211
+ - Context Length: Full 131,072 tokens
212
+ - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
213
+
214
+ For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5-coder-family/), [GitHub](https://github.com/QwenLM/Qwen2.5-Coder), [Documentation](https://qwen.readthedocs.io/en/latest/), [Arxiv](https://arxiv.org/abs/2409.12186).
215
+
216
+ ## Requirements
217
+
218
+ The code of Qwen2.5-Coder has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
219
+
220
+ With `transformers<4.37.0`, you will encounter the following error:
221
+ ```
222
+ KeyError: 'qwen2'
223
+ ```
224
+
225
+ ## Quickstart
226
+
227
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
228
+
229
+ ```python
230
+ from transformers import AutoModelForCausalLM, AutoTokenizer
231
+
232
+ model_name = "Qwen/Qwen2.5-Coder-14B-Instruct"
233
+
234
+ model = AutoModelForCausalLM.from_pretrained(
235
+ model_name,
236
+ torch_dtype="auto",
237
+ device_map="auto"
238
+ )
239
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
240
+
241
+ prompt = "write a quick sort algorithm."
242
+ messages = [
243
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
244
+ {"role": "user", "content": prompt}
245
+ ]
246
+ text = tokenizer.apply_chat_template(
247
+ messages,
248
+ tokenize=False,
249
+ add_generation_prompt=True
250
+ )
251
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
252
+
253
+ generated_ids = model.generate(
254
+ **model_inputs,
255
+ max_new_tokens=512
256
+ )
257
+ generated_ids = [
258
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
259
+ ]
260
+
261
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
262
+ ```
263
+
264
+ ### Processing Long Texts
265
+
266
+ The current `config.json` is set for context length up to 32,768 tokens.
267
+ To handle extensive inputs exceeding 32,768 tokens, we utilize [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
268
+
269
+ For supported frameworks, you could add the following to `config.json` to enable YaRN:
270
+ ```json
271
+ {
272
+ ...,
273
+ "rope_scaling": {
274
+ "factor": 4.0,
275
+ "original_max_position_embeddings": 32768,
276
+ "type": "yarn"
277
+ }
278
+ }
279
+ ```
280
+
281
+ For deployment, we recommend using vLLM.
282
+ Please refer to our [Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
283
+ Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
284
+ We advise adding the `rope_scaling` configuration only when processing long contexts is required.
285
+
286
+ ## Evaluation & Performance
287
+
288
+ Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5-coder-family/).
289
+
290
+ For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
291
+
292
+ See also:
293
+
294
+ https://huggingface.co/Qwen/Qwen2.5-Coder-14B-Instruct
295
+
296
+ ---
297
+
298
+ For more information / other Qwen/Mistral Coders / additional settings see:
299
+
300
+ [ https://huggingface.co/DavidAU/Qwen2.5-MOE-2x-4x-6x-8x__7B__Power-CODER__19B-30B-42B-53B-gguf ]
301
+
302
+ ---
303
+
304
+ <H2>Help, Adjustments, Samplers, Parameters and More</H2>
305
+
306
+ ---
307
+
308
+ <B>CHANGE THE NUMBER OF ACTIVE EXPERTS:</B>
309
+
310
+ See this document:
311
+
312
+ https://huggingface.co/DavidAU/How-To-Set-and-Manage-MOE-Mix-of-Experts-Model-Activation-of-Experts
313
+
314
+ <B>Settings: CHAT / ROLEPLAY and/or SMOOTHER operation of this model:</B>
315
+
316
+ In "KoboldCpp" or "oobabooga/text-generation-webui" or "Silly Tavern" ;
317
+
318
+ Set the "Smoothing_factor" to 1.5
319
+
320
+ : in KoboldCpp -> Settings->Samplers->Advanced-> "Smooth_F"
321
+
322
+ : in text-generation-webui -> parameters -> lower right.
323
+
324
+ : In Silly Tavern this is called: "Smoothing"
325
+
326
+
327
+ NOTE: For "text-generation-webui"
328
+
329
+ -> if using GGUFs you need to use "llama_HF" (which involves downloading some config files from the SOURCE version of this model)
330
+
331
+ Source versions (and config files) of my models are here:
332
+
333
+ https://huggingface.co/collections/DavidAU/d-au-source-files-for-gguf-exl2-awq-gptq-hqq-etc-etc-66b55cb8ba25f914cbf210be
334
+
335
+ OTHER OPTIONS:
336
+
337
+ - Increase rep pen to 1.1 to 1.15 (you don't need to do this if you use "smoothing_factor")
338
+
339
+ - If the interface/program you are using to run AI MODELS supports "Quadratic Sampling" ("smoothing") just make the adjustment as noted.
340
+
341
+ <B>Highest Quality Settings / Optimal Operation Guide / Parameters and Samplers</B>
342
+
343
+ This a "Class 1" model:
344
+
345
+ 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:
346
+
347
+ [ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]
348
+
349
+ You can see all parameters used for generation, in addition to advanced parameters and samplers to get the most out of this model here:
350
+
351
+ [ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]