RichardErkhov commited on
Commit
ec6ab4d
1 Parent(s): 7401922

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +466 -0
README.md ADDED
@@ -0,0 +1,466 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ CursorCore-DS-1.3B - GGUF
11
+ - Model creator: https://huggingface.co/TechxGenus/
12
+ - Original model: https://huggingface.co/TechxGenus/CursorCore-DS-1.3B/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [CursorCore-DS-1.3B.Q2_K.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q2_K.gguf) | Q2_K | 0.52GB |
18
+ | [CursorCore-DS-1.3B.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.IQ3_XS.gguf) | IQ3_XS | 0.57GB |
19
+ | [CursorCore-DS-1.3B.IQ3_S.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.IQ3_S.gguf) | IQ3_S | 0.6GB |
20
+ | [CursorCore-DS-1.3B.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q3_K_S.gguf) | Q3_K_S | 0.6GB |
21
+ | [CursorCore-DS-1.3B.IQ3_M.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.IQ3_M.gguf) | IQ3_M | 0.63GB |
22
+ | [CursorCore-DS-1.3B.Q3_K.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q3_K.gguf) | Q3_K | 0.66GB |
23
+ | [CursorCore-DS-1.3B.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q3_K_M.gguf) | Q3_K_M | 0.66GB |
24
+ | [CursorCore-DS-1.3B.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q3_K_L.gguf) | Q3_K_L | 0.69GB |
25
+ | [CursorCore-DS-1.3B.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.IQ4_XS.gguf) | IQ4_XS | 0.7GB |
26
+ | [CursorCore-DS-1.3B.Q4_0.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q4_0.gguf) | Q4_0 | 0.72GB |
27
+ | [CursorCore-DS-1.3B.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.IQ4_NL.gguf) | IQ4_NL | 0.73GB |
28
+ | [CursorCore-DS-1.3B.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q4_K_S.gguf) | Q4_K_S | 0.76GB |
29
+ | [CursorCore-DS-1.3B.Q4_K.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q4_K.gguf) | Q4_K | 0.81GB |
30
+ | [CursorCore-DS-1.3B.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q4_K_M.gguf) | Q4_K_M | 0.81GB |
31
+ | [CursorCore-DS-1.3B.Q4_1.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q4_1.gguf) | Q4_1 | 0.8GB |
32
+ | [CursorCore-DS-1.3B.Q5_0.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q5_0.gguf) | Q5_0 | 0.87GB |
33
+ | [CursorCore-DS-1.3B.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q5_K_S.gguf) | Q5_K_S | 0.89GB |
34
+ | [CursorCore-DS-1.3B.Q5_K.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q5_K.gguf) | Q5_K | 0.93GB |
35
+ | [CursorCore-DS-1.3B.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q5_K_M.gguf) | Q5_K_M | 0.93GB |
36
+ | [CursorCore-DS-1.3B.Q5_1.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q5_1.gguf) | Q5_1 | 0.95GB |
37
+ | [CursorCore-DS-1.3B.Q6_K.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q6_K.gguf) | Q6_K | 1.09GB |
38
+ | [CursorCore-DS-1.3B.Q8_0.gguf](https://huggingface.co/RichardErkhov/TechxGenus_-_CursorCore-DS-1.3B-gguf/blob/main/CursorCore-DS-1.3B.Q8_0.gguf) | Q8_0 | 1.33GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ tags:
46
+ - code
47
+ base_model:
48
+ - deepseek-ai/deepseek-coder-1.3b-base
49
+ library_name: transformers
50
+ pipeline_tag: text-generation
51
+ license: other
52
+ license_name: deepseek
53
+ license_link: LICENSE
54
+ ---
55
+
56
+ # CursorCore: Assist Programming through Aligning Anything
57
+
58
+ <p align="center">
59
+ <a href="http://arxiv.org/abs/2410.07002">[📄arXiv]</a> |
60
+ <a href="https://hf.co/papers/2410.07002">[🤗HF Paper]</a> |
61
+ <a href="https://huggingface.co/collections/TechxGenus/cursorcore-series-6706618c38598468866b60e2">[🤖Models]</a> |
62
+ <a href="https://github.com/TechxGenus/CursorCore">[🛠️Code]</a> |
63
+ <a href="https://github.com/TechxGenus/CursorWeb">[Web]</a> |
64
+ <a href="https://discord.gg/Z5Tev8fV">[Discord]</a>
65
+ </p>
66
+
67
+ <hr>
68
+
69
+ - [CursorCore: Assist Programming through Aligning Anything](#cursorcore-assist-programming-through-aligning-anything)
70
+ - [Introduction](#introduction)
71
+ - [Models](#models)
72
+ - [Usage](#usage)
73
+ - [1) Normal chat](#1-normal-chat)
74
+ - [2) Assistant-Conversation](#2-assistant-conversation)
75
+ - [3) Web Demo](#3-web-demo)
76
+ - [Future Work](#future-work)
77
+ - [Citation](#citation)
78
+ - [Contribution](#contribution)
79
+
80
+ <hr>
81
+
82
+ ## Introduction
83
+
84
+ CursorCore is a series of open-source models designed for AI-assisted programming. It aims to support features such as automated editing and inline chat, replicating the core abilities of closed-source AI-assisted programming tools like Cursor. This is achieved by aligning data generated through Programming-Instruct. Please read [our paper](http://arxiv.org/abs/2410.07002) to learn more.
85
+
86
+ <p align="center">
87
+ <img width="100%" alt="conversation" src="https://raw.githubusercontent.com/TechxGenus/CursorCore/main/pictures/conversation.png">
88
+ </p>
89
+
90
+ ![CursorWeb](https://raw.githubusercontent.com/TechxGenus/CursorCore/main/pictures/CursorWeb.gif)
91
+
92
+ ## Models
93
+
94
+ Our models have been open-sourced on Hugging Face. You can access our models here: [CursorCore-Series](https://huggingface.co/collections/TechxGenus/cursorcore-series-6706618c38598468866b60e2"). We also provide pre-quantized weights for GPTQ and AWQ here: [CursorCore-Quantization](https://huggingface.co/collections/TechxGenus/cursorcore-quantization-67066431f29f252494ee8cf3)
95
+
96
+ ## Usage
97
+
98
+ Here are some examples of how to use our model:
99
+
100
+ ### 1) Normal chat
101
+
102
+ Script:
103
+
104
+ ````python
105
+ import torch
106
+ from transformers import AutoTokenizer, AutoModelForCausalLM
107
+
108
+ tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-9B")
109
+ model = AutoModelForCausalLM.from_pretrained(
110
+ "TechxGenus/CursorCore-Yi-9B",
111
+ torch_dtype=torch.bfloat16,
112
+ device_map="auto"
113
+ )
114
+
115
+ messages = [
116
+ {"role": "user", "content": "Hi!"},
117
+ ]
118
+ prompt = tokenizer.apply_chat_template(
119
+ messages,
120
+ tokenize=False,
121
+ add_generation_prompt=True
122
+ )
123
+
124
+ inputs = tokenizer.encode(prompt, return_tensors="pt")
125
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512)
126
+ print(tokenizer.decode(outputs[0]))
127
+ ````
128
+
129
+ Output:
130
+
131
+ ````txt
132
+ <|im_start|>system
133
+ You are a helpful programming assistant.<|im_end|>
134
+ <|im_start|>user
135
+ Hi!<|im_end|>
136
+ <|im_start|>assistant
137
+ Hello! I'm an AI language model and I can help you with any programming questions you might have. What specific problem or task are you trying to solve?<|im_end|>
138
+ ````
139
+
140
+ ### 2) Assistant-Conversation
141
+
142
+ In our work, we introduce a new framework of AI-assisted programming task. It is designed for aligning anything during programming process, used for the implementation of features like Tab and Inline Chat.
143
+
144
+ Script 1:
145
+
146
+ ````python
147
+ import torch
148
+ from transformers import AutoTokenizer, AutoModelForCausalLM
149
+ from eval.utils import prepare_input_for_wf
150
+
151
+ tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-9B")
152
+ model = AutoModelForCausalLM.from_pretrained(
153
+ "TechxGenus/CursorCore-Yi-9B",
154
+ torch_dtype=torch.bfloat16,
155
+ device_map="auto"
156
+ )
157
+ sample = {
158
+ "history": [
159
+ {
160
+ "type": "code",
161
+ "lang": "python",
162
+ "code": """def quick_sort(arr):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n left = [x for x in arr if x < pivot]\n middle = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quick_sort(left) + middle + quick_sort(right)"""
163
+ }
164
+ ],
165
+ "current": {
166
+ "type": "code",
167
+ "lang": "python",
168
+ "code": """def quick_sort(array):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n left = [x for x in arr if x < pivot]\n middle = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quick_sort(left) + middle + quick_sort(right)"""
169
+ },
170
+ "user": ""
171
+ }
172
+
173
+ prompt = tokenizer.apply_chat_template(
174
+ prepare_input_for_wf(sample),
175
+ tokenize=False,
176
+ chat_template="assistant-conversation",
177
+ add_generation_prompt=True
178
+ )
179
+
180
+ inputs = tokenizer.encode(prompt, return_tensors="pt")
181
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512, do_sample=False)
182
+ print(tokenizer.decode(outputs[0]))
183
+ ````
184
+
185
+ Output 1:
186
+
187
+ ````txt
188
+ <|im_start|>system
189
+ You are a helpful programming assistant.<|im_end|>
190
+ <|im_start|>history
191
+ ```python
192
+ def quick_sort(arr):
193
+ if len(arr) <= 1:
194
+ return arr
195
+ pivot = arr[len(arr) // 2]
196
+ left = [x for x in arr if x < pivot]
197
+ middle = [x for x in arr if x == pivot]
198
+ right = [x for x in arr if x > pivot]
199
+ return quick_sort(left) + middle + quick_sort(right)
200
+ ```<|im_end|>
201
+ <|im_start|>current
202
+ ```python
203
+ def quick_sort(array):
204
+ if len(arr) <= 1:
205
+ return arr
206
+ pivot = arr[len(arr) // 2]
207
+ left = [x for x in arr if x < pivot]
208
+ middle = [x for x in arr if x == pivot]
209
+ right = [x for x in arr if x > pivot]
210
+ return quick_sort(left) + middle + quick_sort(right)
211
+ ```<|im_end|>
212
+ <|im_start|>assistant
213
+ <|next_start|>```python
214
+ def quick_sort(array):
215
+ if len(array) <= 1:
216
+ return array
217
+ pivot = array[len(array) // 2]
218
+ left = [x for x in array if x < pivot]
219
+ middle = [x for x in array if x == pivot]
220
+ right = [x for x in array if x > pivot]
221
+ return quick_sort(left) + middle + quick_sort(right)
222
+ ```<|next_end|>
223
+ The user has provided a revised code change that corrects the parameter name from `arr` to `array` in the `quick_sort` function. This change ensures consistency in the function definition and avoids potential confusion or errors.
224
+
225
+ To implement this, we will:
226
+ 1. Update the parameter name in the function definition from `arr` to `array`.
227
+ 2. Ensure that all references to `arr` within the function are updated to `array`.
228
+
229
+ This will make the function definition and internal references consistent, improving code readability and maintainability.<|im_end|>
230
+ ````
231
+
232
+ Script 2:
233
+
234
+ ````python
235
+ import torch
236
+ from transformers import AutoTokenizer, AutoModelForCausalLM
237
+ from eval.utils import prepare_input_for_wf
238
+
239
+ tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-9B")
240
+ model = AutoModelForCausalLM.from_pretrained(
241
+ "TechxGenus/CursorCore-Yi-9B",
242
+ torch_dtype=torch.bfloat16,
243
+ device_map="auto"
244
+ )
245
+ sample = {
246
+ "history": [],
247
+ "current": {
248
+ "type": "code",
249
+ "lang": "python",
250
+ "code": """def quick_sort(array):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n left = [x for x in arr if x < pivot]\n middle = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quick_sort(left) + middle + quick_sort(right)"""
251
+ },
252
+ "user": "Add Docstring."
253
+ }
254
+
255
+ prompt = tokenizer.apply_chat_template(
256
+ prepare_input_for_wf(sample),
257
+ tokenize=False,
258
+ chat_template="assistant-conversation",
259
+ add_generation_prompt=True
260
+ )
261
+
262
+ inputs = tokenizer.encode(prompt, return_tensors="pt")
263
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512, do_sample=False)
264
+ print(tokenizer.decode(outputs[0]))
265
+ ````
266
+
267
+ Output 2:
268
+
269
+ ````txt
270
+ <|im_start|>system
271
+ You are a helpful programming assistant.<|im_end|>
272
+ <|im_start|>current
273
+ ```python
274
+ def quick_sort(array):
275
+ if len(arr) <= 1:
276
+ return arr
277
+ pivot = arr[len(arr) // 2]
278
+ left = [x for x in arr if x < pivot]
279
+ middle = [x for x in arr if x == pivot]
280
+ right = [x for x in arr if x > pivot]
281
+ return quick_sort(left) + middle + quick_sort(right)
282
+ ```<|im_end|>
283
+ <|im_start|>user
284
+ Add Docstring.<|im_end|>
285
+ <|im_start|>assistant
286
+ <|next_start|>```python
287
+ def quick_sort(array):
288
+ """
289
+ This is an implementation of the quick sort algorithm.
290
+ """
291
+ if len(arr) <= 1:
292
+ return arr
293
+ pivot = arr[len(arr) // 2]
294
+ left = [x for x in arr if x < pivot]
295
+ middle = [x for x in arr if x == pivot]
296
+ right = [x for x in arr if x > pivot]
297
+ return quick_sort(left) + middle + quick_sort(right)
298
+ ```<|next_end|><|im_end|>
299
+ ````
300
+
301
+ For models in Locate-and-Change (LC) and Search-and-Replace (SR) formats, the output examples are as follows:
302
+
303
+ Script for LC:
304
+
305
+ ````python
306
+ import torch
307
+ from transformers import AutoTokenizer, AutoModelForCausalLM
308
+ from eval.utils import prepare_input_for_lc
309
+
310
+ tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-1.5B-LC")
311
+ model = AutoModelForCausalLM.from_pretrained(
312
+ "TechxGenus/CursorCore-Yi-1.5B-LC",
313
+ torch_dtype=torch.bfloat16,
314
+ device_map="auto"
315
+ )
316
+ sample = {
317
+ "history": [],
318
+ "current": {
319
+ "type": "code",
320
+ "lang": "python",
321
+ "code": """def quick_sort(array):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n left = [x for x in arr if x < pivot]\n middle = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quick_sort(left) + middle + quick_sort(right)"""
322
+ },
323
+ "user": "Add Docstring."
324
+ }
325
+
326
+ prompt = tokenizer.apply_chat_template(
327
+ prepare_input_for_lc(sample),
328
+ tokenize=False,
329
+ chat_template="assistant-conversation",
330
+ add_generation_prompt=True
331
+ )
332
+
333
+ inputs = tokenizer.encode(prompt, return_tensors="pt")
334
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512, do_sample=False)
335
+ print(tokenizer.decode(outputs[0]))
336
+ ````
337
+
338
+ Output for LC:
339
+
340
+ ````txt
341
+ <|im_start|>system
342
+ You are a helpful programming assistant.<|im_end|>
343
+ <|im_start|>current
344
+ ```python
345
+ 1 def quick_sort(array):
346
+ 2 if len(arr) <= 1:
347
+ 3 return arr
348
+ 4 pivot = arr[len(arr) // 2]
349
+ 5 left = [x for x in arr if x < pivot]
350
+ 6 middle = [x for x in arr if x == pivot]
351
+ 7 right = [x for x in arr if x > pivot]
352
+ 8 return quick_sort(left) + middle + quick_sort(right)
353
+ ```<|im_end|>
354
+ <|im_start|>user
355
+ Add Docstring.<|im_end|>
356
+ <|im_start|>assistant
357
+ <|next_start|>1,1
358
+ ```
359
+ '''This function will sort an array using quick sort algorithm'''
360
+ ```<|next_end|>
361
+ To enhance the readability and maintainability of the code, we should add a docstring to the `quick_sort` function. A docstring provides a clear description of what the function does, which is particularly useful for other developers who might use or modify this code in the future.
362
+
363
+ The docstring will be added immediately after the function definition, explaining that the function uses the quick sort algorithm to sort an array. This will make the code more self-explanatory and easier to understand.
364
+
365
+ Here's the plan:
366
+ 1. Add a docstring at the beginning of the `quick_sort` function.
367
+ 2. Ensure the docstring is clear and concise, describing the purpose of the function.
368
+
369
+ This modification will improve the code's documentation without altering its functionality.<|im_end|>
370
+ ````
371
+
372
+ Script for SR:
373
+
374
+ ````python
375
+ import torch
376
+ from transformers import AutoTokenizer, AutoModelForCausalLM
377
+ from eval.utils import prepare_input_for_sr
378
+
379
+ tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-1.5B-SR")
380
+ model = AutoModelForCausalLM.from_pretrained(
381
+ "TechxGenus/CursorCore-Yi-1.5B-SR",
382
+ torch_dtype=torch.bfloat16,
383
+ device_map="auto"
384
+ )
385
+ sample = {
386
+ "history": [],
387
+ "current": {
388
+ "type": "code",
389
+ "lang": "python",
390
+ "code": """def quick_sort(array):\n if len(arr) <= 1:\n return arr\n pivot = arr[len(arr) // 2]\n left = [x for x in arr if x < pivot]\n middle = [x for x in arr if x == pivot]\n right = [x for x in arr if x > pivot]\n return quick_sort(left) + middle + quick_sort(right)"""
391
+ },
392
+ "user": "Add Docstring."
393
+ }
394
+
395
+ prompt = tokenizer.apply_chat_template(
396
+ prepare_input_for_sr(sample),
397
+ tokenize=False,
398
+ chat_template="assistant-conversation",
399
+ add_generation_prompt=True
400
+ )
401
+
402
+ inputs = tokenizer.encode(prompt, return_tensors="pt")
403
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512, do_sample=False)
404
+ print(tokenizer.decode(outputs[0]))
405
+ ````
406
+
407
+ Output for SR:
408
+
409
+ ````txt
410
+ <|im_start|>system
411
+ You are a helpful programming assistant.<|im_end|>
412
+ <|im_start|>current
413
+ ```python
414
+ def quick_sort(array):
415
+ if len(arr) <= 1:
416
+ return arr
417
+ pivot = arr[len(arr) // 2]
418
+ left = [x for x in arr if x < pivot]
419
+ middle = [x for x in arr if x == pivot]
420
+ right = [x for x in arr if x > pivot]
421
+ return quick_sort(left) + middle + quick_sort(right)
422
+ ```<|im_end|>
423
+ <|im_start|>user
424
+ Add Docstring.<|im_end|>
425
+ <|im_start|>assistant
426
+ <|next_start|>```python
427
+ def quick_sort(array):
428
+ <|search_and_replace|>
429
+ def quick_sort(array):
430
+ """
431
+ This function implements quick sort algorithm
432
+ """
433
+ ```<|next_end|><|im_end|>
434
+ ````
435
+
436
+ ### 3) Web Demo
437
+
438
+ We create a web demo for CursorCore. Please visit [CursorWeb](https://github.com/TechxGenus/CursorWeb) for more details.
439
+
440
+ ## Future Work
441
+
442
+ CursorCore is still in a very early stage, and lots of work is needed to achieve a better user experience. For example:
443
+
444
+ - Repository-level editing support
445
+ - Better and faster editing formats
446
+ - Better user interface and presentation
447
+ - ...
448
+
449
+ ## Citation
450
+
451
+ ```bibtex
452
+ @article{jiang2024cursorcore,
453
+ title = {CursorCore: Assist Programming through Aligning Anything},
454
+ author = {Hao Jiang and Qi Liu and Rui Li and Shengyu Ye and Shijin Wang},
455
+ year = {2024},
456
+ journal = {arXiv preprint arXiv: 2410.07002}
457
+ }
458
+ ```
459
+
460
+ ## Contribution
461
+
462
+ Contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request.
463
+
464
+
465
+
466
+ Additional thanks to @nicoboss for giving me access to his private supercomputer, enabling me to provide many more quants, at much higher speed, than I would otherwise be able to.