DavidAU commited on
Commit
18f12a5
·
verified ·
1 Parent(s): 5b6b117

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +337 -0
README.md ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - microsoft/NextCoder-7B
5
+ - Qwen/Qwen2.5-Coder-7B-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
+ (uploading...)
35
+
36
+ <h2>Qwen2.5-Microsoft-NextCoder-Instruct-FUSED-CODER-Fast-11B</h2>
37
+
38
+ This repo contains the full precision source code, in "safe tensors" format to generate GGUFs, GPTQ, EXL2, AWQ, HQQ and other formats.
39
+ The source code can also be used directly.
40
+
41
+ This model contains Qwen 7b Coder Instruct FUSED with Microsoft's 7B Coder (instruct model) creating an 11B, 42 layers, 507 tensors model.
42
+
43
+ https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct
44
+
45
+ https://huggingface.co/microsoft/NextCoder-7B
46
+
47
+ Information on the models below, and then a complete help section for running LLM / AI models.
48
+
49
+ The FUSING process enhances model performance.
50
+
51
+ This model requires:
52
+ - Jinja (embedded) or CHATML template
53
+ - Max context of 32k expanded as per Qwen2.5 methods.
54
+
55
+ Settings used for testing (suggested):
56
+ - Temp .3 to .7
57
+ - Rep pen 1.05 to 1.1
58
+ - Topp .8 , minp .05
59
+ - Topk 20
60
+ - No system prompt.
61
+
62
+ This model will respond well to both detailed instructions and step by step refinement and additions to code.
63
+
64
+ As this is an instruct model, it will also benefit from a detailed system prompt too.
65
+
66
+ For simpler coding problems, lower quants will work well; but for complex/multi-step problem solving suggest Q6 or Q8.
67
+
68
+ ---
69
+
70
+ # NextCoder-7B
71
+
72
+ ---
73
+
74
+ <p align="center">
75
+ <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>
76
+ </p>
77
+
78
+ > NextCoder: Robust Adaptation of Code LMs to Diverse Code Edits (ICML'2025)
79
+
80
+ ## Introduction
81
+
82
+ 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.
83
+ Following are the key improvements:
84
+ - 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.
85
+ - No loss of generalizibility, due to our new finetuning method **SeleKT**
86
+ - **Long-context Support** up to 32K tokens.
87
+
88
+ **This repo contains the NextCoder-7B model**, which has the following features:
89
+ - Type: Causal Language Models
90
+ - Training Stage: Post-training with SeleKT
91
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
92
+ - Number of Parameters: 7.61B
93
+ - Number of Paramaters (Non-Embedding): 6.53B
94
+ - Number of Layers: 28
95
+ - Number of Attention Heads (GQA): 28 for Q and 4 for KV
96
+
97
+ 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/).
98
+
99
+ ## Requirements
100
+
101
+ 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`.
102
+
103
+ With `transformers<4.37.0`, you will encounter the following error:
104
+ ```
105
+ KeyError: 'qwen2'
106
+ ```
107
+
108
+ ## Quickstart
109
+
110
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
111
+
112
+ ```python
113
+ from transformers import AutoModelForCausalLM, AutoTokenizer
114
+
115
+ model_name = "microsoft/NextCoder-7B"
116
+
117
+ model = AutoModelForCausalLM.from_pretrained(
118
+ model_name,
119
+ torch_dtype="auto",
120
+ device_map="auto",
121
+ )
122
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
123
+
124
+ prompt = """
125
+ Fix the following function that divides two numbers to handle all the edge cases:
126
+
127
+ def divide(a, b)
128
+ returm a/b
129
+ """
130
+ messages = [
131
+ {"role": "user", "content": prompt}
132
+ ]
133
+ text = tokenizer.apply_chat_template(
134
+ messages,
135
+ tokenize=False,
136
+ add_generation_prompt=True
137
+ )
138
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
139
+
140
+ generated_ids = model.generate(
141
+ **model_inputs,
142
+ max_new_tokens=1024
143
+ )
144
+ generated_ids = [
145
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
146
+ ]
147
+
148
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
149
+ ```
150
+ ## Evaluation and Performance
151
+
152
+ | Models | HUMANEVALFIX | CANITEDIT | AIDER | POLYGLOT |
153
+ |--------|---------------|-----------|-------|----------|
154
+ | QwenCoder-2.5-3B | 73.2 | 37.1 | 36.8 | - |
155
+ | QwenCoder-2.5-3B-LoRA | 64.6 | 36.2 | 35.8 | - |
156
+ | QwenCoder-2.5-3B-SFT | 76.2 | 32.4 | 30.1 | - |
157
+ | **NextCoder-3B** | 75.6 | 42.4 | 37.6 | - |
158
+ | QwenCoder-2.5-7B | 73.8 | 48.1 | 59.4 | - |
159
+ | QwenCoder-2.5-7B-LoRA | 70.7 | 44.3 | 40.6 | - |
160
+ | QwenCoder-2.5-7B-SFT | 70.1 | 36.7 | 48.9 | - |
161
+ | **NextCoder-7B** | 81.1 | 50.5 | 65.7 | - |
162
+ | QwenCoder-2.5-14B | 87.8 | 58.1 | 66.9 | 9.3 |
163
+ | QwenCoder-2.5-14B-LoRA | 78.0 | 50.9 | 66.2 | 5.3 |
164
+ | QwenCoder-2.5-14B-SFT | 79.9 | 42.4 | 36.8 | 3.1 |
165
+ | **NextCoder-14B** | 89.8 | 60.2 | 72.2 | 12.2 |
166
+ | QwenCoder-2.5-32B | **90.2** | 61.0 | 72.9 | 16.4 |
167
+ | QwenCoder-2.5-32B-LoRA | 82.3 | 52.4 | 60.2 | 6.7 |
168
+ | QwenCoder-2.5-32B-SFT | 81.7 | 49.5 | 66.9 | 8.4 |
169
+ | **NextCoder-32B** | 88.9 | **62.4** | **74.7** | **23.6** |
170
+
171
+ *Comparison of base QwenCoder-2.5 models of different sizes and their SELEKT-enhanced versions across three code editing benchmarks.*
172
+
173
+ **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/).**
174
+
175
+ See more here:
176
+
177
+ https://huggingface.co/microsoft/NextCoder-7B
178
+
179
+ ---
180
+
181
+ # Qwen2.5-Coder-7B-Instruct
182
+
183
+ ---
184
+
185
+ ## Introduction
186
+
187
+ 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:
188
+
189
+ - 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.
190
+ - 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.
191
+ - **Long-context Support** up to 128K tokens.
192
+
193
+ **This repo contains the instruction-tuned 7B Qwen2.5-Coder model**, which has the following features:
194
+ - Type: Causal Language Models
195
+ - Training Stage: Pretraining & Post-training
196
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
197
+ - Number of Parameters: 7.61B
198
+ - Number of Paramaters (Non-Embedding): 6.53B
199
+ - Number of Layers: 28
200
+ - Number of Attention Heads (GQA): 28 for Q and 4 for KV
201
+ - Context Length: Full 131,072 tokens
202
+ - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
203
+
204
+ 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).
205
+
206
+ ## Requirements
207
+
208
+ 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`.
209
+
210
+ With `transformers<4.37.0`, you will encounter the following error:
211
+ ```
212
+ KeyError: 'qwen2'
213
+ ```
214
+
215
+ ## Quickstart
216
+
217
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
218
+
219
+ ```python
220
+ from transformers import AutoModelForCausalLM, AutoTokenizer
221
+
222
+ model_name = "Qwen/Qwen2.5-Coder-7B-Instruct"
223
+
224
+ model = AutoModelForCausalLM.from_pretrained(
225
+ model_name,
226
+ torch_dtype="auto",
227
+ device_map="auto"
228
+ )
229
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
230
+
231
+ prompt = "write a quick sort algorithm."
232
+ messages = [
233
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
234
+ {"role": "user", "content": prompt}
235
+ ]
236
+ text = tokenizer.apply_chat_template(
237
+ messages,
238
+ tokenize=False,
239
+ add_generation_prompt=True
240
+ )
241
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
242
+
243
+ generated_ids = model.generate(
244
+ **model_inputs,
245
+ max_new_tokens=512
246
+ )
247
+ generated_ids = [
248
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
249
+ ]
250
+
251
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
252
+ ```
253
+
254
+ ### Processing Long Texts
255
+
256
+ The current `config.json` is set for context length up to 32,768 tokens.
257
+ 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.
258
+
259
+ For supported frameworks, you could add the following to `config.json` to enable YaRN:
260
+ ```json
261
+ {
262
+ ...,
263
+ "rope_scaling": {
264
+ "factor": 4.0,
265
+ "original_max_position_embeddings": 32768,
266
+ "type": "yarn"
267
+ }
268
+ }
269
+ ```
270
+
271
+ For deployment, we recommend using vLLM.
272
+ Please refer to our [Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
273
+ Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
274
+ We advise adding the `rope_scaling` configuration only when processing long contexts is required.
275
+
276
+ ## Evaluation & Performance
277
+
278
+ Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5-coder-family/).
279
+
280
+ For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
281
+
282
+
283
+
284
+ For more information / other Qwen/Mistral Coders / additional settings see:
285
+
286
+ [ https://huggingface.co/DavidAU/Qwen2.5-MOE-2x-4x-6x-8x__7B__Power-CODER__19B-30B-42B-53B-gguf ]
287
+
288
+ ---
289
+
290
+ <H2>Help, Adjustments, Samplers, Parameters and More</H2>
291
+
292
+ ---
293
+
294
+ <B>CHANGE THE NUMBER OF ACTIVE EXPERTS:</B>
295
+
296
+ See this document:
297
+
298
+ https://huggingface.co/DavidAU/How-To-Set-and-Manage-MOE-Mix-of-Experts-Model-Activation-of-Experts
299
+
300
+ <B>Settings: CHAT / ROLEPLAY and/or SMOOTHER operation of this model:</B>
301
+
302
+ In "KoboldCpp" or "oobabooga/text-generation-webui" or "Silly Tavern" ;
303
+
304
+ Set the "Smoothing_factor" to 1.5
305
+
306
+ : in KoboldCpp -> Settings->Samplers->Advanced-> "Smooth_F"
307
+
308
+ : in text-generation-webui -> parameters -> lower right.
309
+
310
+ : In Silly Tavern this is called: "Smoothing"
311
+
312
+
313
+ NOTE: For "text-generation-webui"
314
+
315
+ -> if using GGUFs you need to use "llama_HF" (which involves downloading some config files from the SOURCE version of this model)
316
+
317
+ Source versions (and config files) of my models are here:
318
+
319
+ https://huggingface.co/collections/DavidAU/d-au-source-files-for-gguf-exl2-awq-gptq-hqq-etc-etc-66b55cb8ba25f914cbf210be
320
+
321
+ OTHER OPTIONS:
322
+
323
+ - Increase rep pen to 1.1 to 1.15 (you don't need to do this if you use "smoothing_factor")
324
+
325
+ - If the interface/program you are using to run AI MODELS supports "Quadratic Sampling" ("smoothing") just make the adjustment as noted.
326
+
327
+ <B>Highest Quality Settings / Optimal Operation Guide / Parameters and Samplers</B>
328
+
329
+ This a "Class 1" model:
330
+
331
+ 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:
332
+
333
+ [ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]
334
+
335
+ You can see all parameters used for generation, in addition to advanced parameters and samplers to get the most out of this model here:
336
+
337
+ [ https://huggingface.co/DavidAU/Maximizing-Model-Performance-All-Quants-Types-And-Full-Precision-by-Samplers_Parameters ]