Datasets:
well can this work?
Browse files- repobench-p.py +36 -17
repobench-p.py
CHANGED
@@ -46,7 +46,7 @@ _URLs = {
|
|
46 |
"java": "https://raw.githubusercontent.com/Leolty/repobench/main/data/pipeline/java/"
|
47 |
}
|
48 |
|
49 |
-
class
|
50 |
"""RepoBench"""
|
51 |
|
52 |
VERSION = datasets.Version("1.0.0")
|
@@ -70,22 +70,40 @@ class RepoBenchC(datasets.GeneratorBasedBuilder):
|
|
70 |
)
|
71 |
]
|
72 |
|
|
|
|
|
73 |
def _info(self):
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
"
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
return datasets.DatasetInfo(
|
91 |
description=_DESCRIPTION,
|
@@ -125,7 +143,8 @@ class RepoBenchC(datasets.GeneratorBasedBuilder):
|
|
125 |
with gzip.open(data_dir[split], "rb") as f:
|
126 |
data = pickle.load(f)
|
127 |
|
128 |
-
|
|
|
129 |
for i, example in enumerate(data):
|
130 |
|
131 |
yield i, example
|
|
|
46 |
"java": "https://raw.githubusercontent.com/Leolty/repobench/main/data/pipeline/java/"
|
47 |
}
|
48 |
|
49 |
+
class RepoBenchP(datasets.GeneratorBasedBuilder):
|
50 |
"""RepoBench"""
|
51 |
|
52 |
VERSION = datasets.Version("1.0.0")
|
|
|
70 |
)
|
71 |
]
|
72 |
|
73 |
+
DEFAULT_SPLIT_NAME = "cff"
|
74 |
+
|
75 |
def _info(self):
|
76 |
+
if self.DEFAULT_SPLIT_NAME == "if":
|
77 |
+
features = datasets.Features(
|
78 |
+
{
|
79 |
+
"repo_name": datasets.Value("string"),
|
80 |
+
"file_path": datasets.Value("string"),
|
81 |
+
"context": datasets.Sequence(feature={
|
82 |
+
"path": datasets.Value("string"),
|
83 |
+
"identifier": datasets.Value("string"),
|
84 |
+
"snippet": datasets.Value("string")
|
85 |
+
}),
|
86 |
+
"import_statement": datasets.Value("string"),
|
87 |
+
"code": datasets.Value("string"),
|
88 |
+
"next_line": datasets.Value("string")
|
89 |
+
}
|
90 |
+
)
|
91 |
+
else:
|
92 |
+
features = datasets.Features(
|
93 |
+
{
|
94 |
+
"repo_name": datasets.Value("string"),
|
95 |
+
"file_path": datasets.Value("string"),
|
96 |
+
"context": datasets.Sequence(feature={
|
97 |
+
"path": datasets.Value("string"),
|
98 |
+
"identifier": datasets.Value("string"),
|
99 |
+
"snippet": datasets.Value("string")
|
100 |
+
}),
|
101 |
+
"import_statement": datasets.Value("string"),
|
102 |
+
"code": datasets.Value("string"),
|
103 |
+
"next_line": datasets.Value("string"),
|
104 |
+
"gold_snippet_index": datasets.Value("int32")
|
105 |
+
}
|
106 |
+
)
|
107 |
|
108 |
return datasets.DatasetInfo(
|
109 |
description=_DESCRIPTION,
|
|
|
143 |
with gzip.open(data_dir[split], "rb") as f:
|
144 |
data = pickle.load(f)
|
145 |
|
146 |
+
self.DEFAULT_SPLIT_NAME = split
|
147 |
+
|
148 |
for i, example in enumerate(data):
|
149 |
|
150 |
yield i, example
|