Triangle104
commited on
Commit
•
e632b42
1
Parent(s):
180e337
Update README.md
Browse files
README.md
CHANGED
@@ -13,6 +13,377 @@ tags:
|
|
13 |
This model was converted to GGUF format from [`TechxGenus/CursorCore-QW2.5-7B`](https://huggingface.co/TechxGenus/CursorCore-QW2.5-7B) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
14 |
Refer to the [original model card](https://huggingface.co/TechxGenus/CursorCore-QW2.5-7B) for more details on the model.
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
## Use with llama.cpp
|
17 |
Install llama.cpp through brew (works on Mac and Linux)
|
18 |
|
|
|
13 |
This model was converted to GGUF format from [`TechxGenus/CursorCore-QW2.5-7B`](https://huggingface.co/TechxGenus/CursorCore-QW2.5-7B) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
14 |
Refer to the [original model card](https://huggingface.co/TechxGenus/CursorCore-QW2.5-7B) for more details on the model.
|
15 |
|
16 |
+
---
|
17 |
+
Model details:
|
18 |
+
-
|
19 |
+
CursorCore: Assist Programming through Aligning Anything
|
20 |
+
|
21 |
+
CursorCore: Assist Programming through Aligning Anything
|
22 |
+
Introduction
|
23 |
+
Models
|
24 |
+
Usage
|
25 |
+
1) Normal chat
|
26 |
+
2) Assistant-Conversation
|
27 |
+
3) Web Demo
|
28 |
+
Future Work
|
29 |
+
Citation
|
30 |
+
Contribution
|
31 |
+
|
32 |
+
Introduction
|
33 |
+
|
34 |
+
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 to learn more.
|
35 |
+
|
36 |
+
conversation
|
37 |
+
|
38 |
+
CursorWeb
|
39 |
+
Models
|
40 |
+
|
41 |
+
Our models have been open-sourced on Hugging Face. You can access our models here: CursorCore-Series. We also provide pre-quantized weights for GPTQ and AWQ here: CursorCore-Quantization
|
42 |
+
Usage
|
43 |
+
|
44 |
+
Here are some examples of how to use our model:
|
45 |
+
1) Normal chat
|
46 |
+
|
47 |
+
Script:
|
48 |
+
|
49 |
+
import torch
|
50 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
51 |
+
|
52 |
+
tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-9B")
|
53 |
+
model = AutoModelForCausalLM.from_pretrained(
|
54 |
+
"TechxGenus/CursorCore-Yi-9B",
|
55 |
+
torch_dtype=torch.bfloat16,
|
56 |
+
device_map="auto"
|
57 |
+
)
|
58 |
+
|
59 |
+
messages = [
|
60 |
+
{"role": "user", "content": "Hi!"},
|
61 |
+
]
|
62 |
+
prompt = tokenizer.apply_chat_template(
|
63 |
+
messages,
|
64 |
+
tokenize=False,
|
65 |
+
add_generation_prompt=True
|
66 |
+
)
|
67 |
+
|
68 |
+
inputs = tokenizer.encode(prompt, return_tensors="pt")
|
69 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512)
|
70 |
+
print(tokenizer.decode(outputs[0]))
|
71 |
+
|
72 |
+
Output:
|
73 |
+
|
74 |
+
<|im_start|>system
|
75 |
+
You are a helpful programming assistant.<|im_end|>
|
76 |
+
<|im_start|>user
|
77 |
+
Hi!<|im_end|>
|
78 |
+
<|im_start|>assistant
|
79 |
+
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|>
|
80 |
+
|
81 |
+
2) Assistant-Conversation
|
82 |
+
|
83 |
+
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.
|
84 |
+
|
85 |
+
Script 1:
|
86 |
+
|
87 |
+
import torch
|
88 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
89 |
+
from eval.utils import prepare_input_for_wf
|
90 |
+
|
91 |
+
tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-9B")
|
92 |
+
model = AutoModelForCausalLM.from_pretrained(
|
93 |
+
"TechxGenus/CursorCore-Yi-9B",
|
94 |
+
torch_dtype=torch.bfloat16,
|
95 |
+
device_map="auto"
|
96 |
+
)
|
97 |
+
sample = {
|
98 |
+
"history": [
|
99 |
+
{
|
100 |
+
"type": "code",
|
101 |
+
"lang": "python",
|
102 |
+
"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)"""
|
103 |
+
}
|
104 |
+
],
|
105 |
+
"current": {
|
106 |
+
"type": "code",
|
107 |
+
"lang": "python",
|
108 |
+
"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)"""
|
109 |
+
},
|
110 |
+
"user": ""
|
111 |
+
}
|
112 |
+
|
113 |
+
prompt = tokenizer.apply_chat_template(
|
114 |
+
prepare_input_for_wf(sample),
|
115 |
+
tokenize=False,
|
116 |
+
chat_template="assistant-conversation",
|
117 |
+
add_generation_prompt=True
|
118 |
+
)
|
119 |
+
|
120 |
+
inputs = tokenizer.encode(prompt, return_tensors="pt")
|
121 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512, do_sample=False)
|
122 |
+
print(tokenizer.decode(outputs[0]))
|
123 |
+
|
124 |
+
Output 1:
|
125 |
+
|
126 |
+
<|im_start|>system
|
127 |
+
You are a helpful programming assistant.<|im_end|>
|
128 |
+
<|im_start|>history
|
129 |
+
```python
|
130 |
+
def quick_sort(arr):
|
131 |
+
if len(arr) <= 1:
|
132 |
+
return arr
|
133 |
+
pivot = arr[len(arr) // 2]
|
134 |
+
left = [x for x in arr if x < pivot]
|
135 |
+
middle = [x for x in arr if x == pivot]
|
136 |
+
right = [x for x in arr if x > pivot]
|
137 |
+
return quick_sort(left) + middle + quick_sort(right)
|
138 |
+
```<|im_end|>
|
139 |
+
<|im_start|>current
|
140 |
+
```python
|
141 |
+
def quick_sort(array):
|
142 |
+
if len(arr) <= 1:
|
143 |
+
return arr
|
144 |
+
pivot = arr[len(arr) // 2]
|
145 |
+
left = [x for x in arr if x < pivot]
|
146 |
+
middle = [x for x in arr if x == pivot]
|
147 |
+
right = [x for x in arr if x > pivot]
|
148 |
+
return quick_sort(left) + middle + quick_sort(right)
|
149 |
+
```<|im_end|>
|
150 |
+
<|im_start|>assistant
|
151 |
+
<|next_start|>```python
|
152 |
+
def quick_sort(array):
|
153 |
+
if len(array) <= 1:
|
154 |
+
return array
|
155 |
+
pivot = array[len(array) // 2]
|
156 |
+
left = [x for x in array if x < pivot]
|
157 |
+
middle = [x for x in array if x == pivot]
|
158 |
+
right = [x for x in array if x > pivot]
|
159 |
+
return quick_sort(left) + middle + quick_sort(right)
|
160 |
+
```<|next_end|>
|
161 |
+
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.
|
162 |
+
|
163 |
+
To implement this, we will:
|
164 |
+
1. Update the parameter name in the function definition from `arr` to `array`.
|
165 |
+
2. Ensure that all references to `arr` within the function are updated to `array`.
|
166 |
+
|
167 |
+
This will make the function definition and internal references consistent, improving code readability and maintainability.<|im_end|>
|
168 |
+
|
169 |
+
Script 2:
|
170 |
+
|
171 |
+
import torch
|
172 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
173 |
+
from eval.utils import prepare_input_for_wf
|
174 |
+
|
175 |
+
tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-9B")
|
176 |
+
model = AutoModelForCausalLM.from_pretrained(
|
177 |
+
"TechxGenus/CursorCore-Yi-9B",
|
178 |
+
torch_dtype=torch.bfloat16,
|
179 |
+
device_map="auto"
|
180 |
+
)
|
181 |
+
sample = {
|
182 |
+
"history": [],
|
183 |
+
"current": {
|
184 |
+
"type": "code",
|
185 |
+
"lang": "python",
|
186 |
+
"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)"""
|
187 |
+
},
|
188 |
+
"user": "Add Docstring."
|
189 |
+
}
|
190 |
+
|
191 |
+
prompt = tokenizer.apply_chat_template(
|
192 |
+
prepare_input_for_wf(sample),
|
193 |
+
tokenize=False,
|
194 |
+
chat_template="assistant-conversation",
|
195 |
+
add_generation_prompt=True
|
196 |
+
)
|
197 |
+
|
198 |
+
inputs = tokenizer.encode(prompt, return_tensors="pt")
|
199 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512, do_sample=False)
|
200 |
+
print(tokenizer.decode(outputs[0]))
|
201 |
+
|
202 |
+
Output 2:
|
203 |
+
|
204 |
+
<|im_start|>system
|
205 |
+
You are a helpful programming assistant.<|im_end|>
|
206 |
+
<|im_start|>current
|
207 |
+
```python
|
208 |
+
def quick_sort(array):
|
209 |
+
if len(arr) <= 1:
|
210 |
+
return arr
|
211 |
+
pivot = arr[len(arr) // 2]
|
212 |
+
left = [x for x in arr if x < pivot]
|
213 |
+
middle = [x for x in arr if x == pivot]
|
214 |
+
right = [x for x in arr if x > pivot]
|
215 |
+
return quick_sort(left) + middle + quick_sort(right)
|
216 |
+
```<|im_end|>
|
217 |
+
<|im_start|>user
|
218 |
+
Add Docstring.<|im_end|>
|
219 |
+
<|im_start|>assistant
|
220 |
+
<|next_start|>```python
|
221 |
+
def quick_sort(array):
|
222 |
+
"""
|
223 |
+
This is an implementation of the quick sort algorithm.
|
224 |
+
"""
|
225 |
+
if len(arr) <= 1:
|
226 |
+
return arr
|
227 |
+
pivot = arr[len(arr) // 2]
|
228 |
+
left = [x for x in arr if x < pivot]
|
229 |
+
middle = [x for x in arr if x == pivot]
|
230 |
+
right = [x for x in arr if x > pivot]
|
231 |
+
return quick_sort(left) + middle + quick_sort(right)
|
232 |
+
```<|next_end|><|im_end|>
|
233 |
+
|
234 |
+
For models in Locate-and-Change (LC) and Search-and-Replace (SR) formats, the output examples are as follows:
|
235 |
+
|
236 |
+
Script for LC:
|
237 |
+
|
238 |
+
import torch
|
239 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
240 |
+
from eval.utils import prepare_input_for_lc
|
241 |
+
|
242 |
+
tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-1.5B-LC")
|
243 |
+
model = AutoModelForCausalLM.from_pretrained(
|
244 |
+
"TechxGenus/CursorCore-Yi-1.5B-LC",
|
245 |
+
torch_dtype=torch.bfloat16,
|
246 |
+
device_map="auto"
|
247 |
+
)
|
248 |
+
sample = {
|
249 |
+
"history": [],
|
250 |
+
"current": {
|
251 |
+
"type": "code",
|
252 |
+
"lang": "python",
|
253 |
+
"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)"""
|
254 |
+
},
|
255 |
+
"user": "Add Docstring."
|
256 |
+
}
|
257 |
+
|
258 |
+
prompt = tokenizer.apply_chat_template(
|
259 |
+
prepare_input_for_lc(sample),
|
260 |
+
tokenize=False,
|
261 |
+
chat_template="assistant-conversation",
|
262 |
+
add_generation_prompt=True
|
263 |
+
)
|
264 |
+
|
265 |
+
inputs = tokenizer.encode(prompt, return_tensors="pt")
|
266 |
+
outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512, do_sample=False)
|
267 |
+
print(tokenizer.decode(outputs[0]))
|
268 |
+
|
269 |
+
Output for LC:
|
270 |
+
|
271 |
+
<|im_start|>system
|
272 |
+
You are a helpful programming assistant.<|im_end|>
|
273 |
+
<|im_start|>current
|
274 |
+
```python
|
275 |
+
1 def quick_sort(array):
|
276 |
+
2 if len(arr) <= 1:
|
277 |
+
3 return arr
|
278 |
+
4 pivot = arr[len(arr) // 2]
|
279 |
+
5 left = [x for x in arr if x < pivot]
|
280 |
+
6 middle = [x for x in arr if x == pivot]
|
281 |
+
7 right = [x for x in arr if x > pivot]
|
282 |
+
8 return quick_sort(left) + middle + quick_sort(right)
|
283 |
+
```<|im_end|>
|
284 |
+
<|im_start|>user
|
285 |
+
Add Docstring.<|im_end|>
|
286 |
+
<|im_start|>assistant
|
287 |
+
<|next_start|>1,1
|
288 |
+
```
|
289 |
+
'''This function will sort an array using quick sort algorithm'''
|
290 |
+
```<|next_end|>
|
291 |
+
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.
|
292 |
+
|
293 |
+
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.
|
294 |
+
|
295 |
+
Here's the plan:
|
296 |
+
1. Add a docstring at the beginning of the `quick_sort` function.
|
297 |
+
2. Ensure the docstring is clear and concise, describing the purpose of the function.
|
298 |
+
|
299 |
+
This modification will improve the code's documentation without altering its functionality.<|im_end|>
|
300 |
+
|
301 |
+
Script for SR:
|
302 |
+
|
303 |
+
import torch
|
304 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
305 |
+
from eval.utils import prepare_input_for_sr
|
306 |
+
|
307 |
+
tokenizer = AutoTokenizer.from_pretrained("TechxGenus/CursorCore-Yi-1.5B-SR")
|
308 |
+
model = AutoModelForCausalLM.from_pretrained(
|
309 |
+
"TechxGenus/CursorCore-Yi-1.5B-SR",
|
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_sr(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 |
+
Output for SR:
|
335 |
+
|
336 |
+
<|im_start|>system
|
337 |
+
You are a helpful programming assistant.<|im_end|>
|
338 |
+
<|im_start|>current
|
339 |
+
```python
|
340 |
+
def quick_sort(array):
|
341 |
+
if len(arr) <= 1:
|
342 |
+
return arr
|
343 |
+
pivot = arr[len(arr) // 2]
|
344 |
+
left = [x for x in arr if x < pivot]
|
345 |
+
middle = [x for x in arr if x == pivot]
|
346 |
+
right = [x for x in arr if x > pivot]
|
347 |
+
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|>```python
|
353 |
+
def quick_sort(array):
|
354 |
+
<|search_and_replace|>
|
355 |
+
def quick_sort(array):
|
356 |
+
"""
|
357 |
+
This function implements quick sort algorithm
|
358 |
+
"""
|
359 |
+
```<|next_end|><|im_end|>
|
360 |
+
|
361 |
+
3) Web Demo
|
362 |
+
|
363 |
+
We create a web demo for CursorCore. Please visit CursorWeb for more details.
|
364 |
+
Future Work
|
365 |
+
|
366 |
+
CursorCore is still in a very early stage, and lots of work is needed to achieve a better user experience. For example:
|
367 |
+
|
368 |
+
Repository-level editing support
|
369 |
+
Better and faster editing formats
|
370 |
+
Better user interface and presentation
|
371 |
+
...
|
372 |
+
|
373 |
+
Citation
|
374 |
+
|
375 |
+
@article{jiang2024cursorcore,
|
376 |
+
title = {CursorCore: Assist Programming through Aligning Anything},
|
377 |
+
author = {Hao Jiang and Qi Liu and Rui Li and Shengyu Ye and Shijin Wang},
|
378 |
+
year = {2024},
|
379 |
+
journal = {arXiv preprint arXiv: 2410.07002}
|
380 |
+
}
|
381 |
+
|
382 |
+
Contribution
|
383 |
+
|
384 |
+
Contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request.
|
385 |
+
|
386 |
+
---
|
387 |
## Use with llama.cpp
|
388 |
Install llama.cpp through brew (works on Mac and Linux)
|
389 |
|