Update README.md
Browse files
README.md
CHANGED
@@ -29,3 +29,43 @@ configs:
|
|
29 |
- split: train
|
30 |
path: data/train-*
|
31 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
- split: train
|
30 |
path: data/train-*
|
31 |
---
|
32 |
+
```python
|
33 |
+
ds_up = ds_debug.map(lambda x, idx: {"problem_id": f"swe_fixer_{idx}"}, with_indices=True)
|
34 |
+
ds_up = ds_up.map(lambda x: {"source": "internlm/SWE-Fixer-Train-Editing-CoT-70K", "task_type": "swe_fixer"})
|
35 |
+
|
36 |
+
num_proc = 16
|
37 |
+
|
38 |
+
# Function to format code files for display
|
39 |
+
def format_files(files):
|
40 |
+
formatted = ""
|
41 |
+
for file_info in files:
|
42 |
+
formatted += f"## `{file_info['file']}`\n```\n{file_info['file content']}\n```\n\n"
|
43 |
+
return formatted
|
44 |
+
|
45 |
+
ds_up = ds_up.map(lambda x: {"in_source_id": x["instance_id"]}, num_proc=num_proc)
|
46 |
+
|
47 |
+
# Format the prompt using the template
|
48 |
+
ds_up = ds_up.map(lambda x: {
|
49 |
+
"prompt": prompt_template.format(
|
50 |
+
issue_description=x['input']['input']['issue'],
|
51 |
+
files=format_files(x['input']['input']['files to be modified'])
|
52 |
+
)
|
53 |
+
}, num_proc=num_proc)
|
54 |
+
|
55 |
+
# Format the golden_standard_solution properly - use repr() to ensure it's a valid Python literal
|
56 |
+
ds_up = ds_up.map(lambda x: {"golden_standard_solution": repr({
|
57 |
+
"edited code": x["output"]["edited code"]
|
58 |
+
})}, num_proc=num_proc)
|
59 |
+
|
60 |
+
ds_up = ds_up.map(lambda x: {"verification_info": repr({
|
61 |
+
"input": x["input"]["input"],
|
62 |
+
"output": x["output"]
|
63 |
+
})}, num_proc=num_proc)
|
64 |
+
|
65 |
+
# Format the metadata as a string representation of a dictionary
|
66 |
+
ds_up = ds_up.map(lambda x: {"metadata": repr({
|
67 |
+
# "input": x["input"]["input"]
|
68 |
+
})}, num_proc=num_proc)
|
69 |
+
|
70 |
+
ds_up = ds_up.select_columns(["problem_id", "source", "task_type", "in_source_id", "prompt", "golden_standard_solution", "verification_info", "metadata"])
|
71 |
+
```
|