RichardErkhov commited on
Commit
200d03c
·
verified ·
1 Parent(s): 699253c

uploaded readme

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