RichardErkhov commited on
Commit
c4b8562
1 Parent(s): 7882dbf

uploaded readme

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