Datasets:
maybe this work?
Browse files- repobench-p.py +26 -4
repobench-p.py
CHANGED
|
@@ -125,8 +125,30 @@ class RepoBenchP(datasets.GeneratorBasedBuilder):
|
|
| 125 |
with gzip.open(data_dir[split], "rb") as f:
|
| 126 |
data = pickle.load(f)
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
|
|
|
| 125 |
with gzip.open(data_dir[split], "rb") as f:
|
| 126 |
data = pickle.load(f)
|
| 127 |
|
| 128 |
+
if split == "cff" or split == "cfr":
|
| 129 |
+
for i, example in enumerate(data):
|
| 130 |
+
|
| 131 |
+
yield i, {
|
| 132 |
+
"repo_name": example["repo_name"],
|
| 133 |
+
"file_path": example["file_path"],
|
| 134 |
+
"context": example["context"],
|
| 135 |
+
"import_statement": example["import_statement"],
|
| 136 |
+
"code": example["code"],
|
| 137 |
+
"next_line": example["next_line"],
|
| 138 |
+
"gold_snippet_index": example["gold_snippet_index"]
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
elif split == "if":
|
| 142 |
+
for i, example in enumerate(data):
|
| 143 |
+
|
| 144 |
+
yield i, {
|
| 145 |
+
"repo_name": example["repo_name"],
|
| 146 |
+
"file_path": example["file_path"],
|
| 147 |
+
"context": example["context"],
|
| 148 |
+
"import_statement": example["import_statement"],
|
| 149 |
+
"code": example["code"],
|
| 150 |
+
"next_line": example["next_line"],
|
| 151 |
+
# in-file data has no gold_snippet_index
|
| 152 |
+
"gold_snippet_index": -1
|
| 153 |
+
}
|
| 154 |
|