alexjercan
commited on
Commit
•
960335f
1
Parent(s):
d64e967
feat: added tests
Browse files
README.md
CHANGED
@@ -26,18 +26,22 @@ dataset_info:
|
|
26 |
dtype: string
|
27 |
- name: description
|
28 |
dtype: string
|
|
|
|
|
|
|
|
|
29 |
splits:
|
30 |
- name: train
|
31 |
-
num_bytes:
|
32 |
num_examples: 4886
|
33 |
- name: validation
|
34 |
-
num_bytes:
|
35 |
num_examples: 1105
|
36 |
- name: test
|
37 |
-
num_bytes:
|
38 |
num_examples: 100
|
39 |
-
download_size:
|
40 |
-
dataset_size:
|
41 |
- config_name: C++
|
42 |
features:
|
43 |
- name: problem_id
|
@@ -64,16 +68,20 @@ dataset_info:
|
|
64 |
dtype: string
|
65 |
- name: description
|
66 |
dtype: string
|
|
|
|
|
|
|
|
|
67 |
splits:
|
68 |
- name: train
|
69 |
-
num_bytes:
|
70 |
num_examples: 39166
|
71 |
- name: validation
|
72 |
-
num_bytes:
|
73 |
num_examples: 19070
|
74 |
- name: test
|
75 |
-
num_bytes:
|
76 |
num_examples: 859
|
77 |
-
download_size:
|
78 |
-
dataset_size:
|
79 |
---
|
|
|
26 |
dtype: string
|
27 |
- name: description
|
28 |
dtype: string
|
29 |
+
- name: input
|
30 |
+
dtype: string
|
31 |
+
- name: output
|
32 |
+
dtype: string
|
33 |
splits:
|
34 |
- name: train
|
35 |
+
num_bytes: 17032943
|
36 |
num_examples: 4886
|
37 |
- name: validation
|
38 |
+
num_bytes: 3480153
|
39 |
num_examples: 1105
|
40 |
- name: test
|
41 |
+
num_bytes: 200592
|
42 |
num_examples: 100
|
43 |
+
download_size: 22763575
|
44 |
+
dataset_size: 20713688
|
45 |
- config_name: C++
|
46 |
features:
|
47 |
- name: problem_id
|
|
|
68 |
dtype: string
|
69 |
- name: description
|
70 |
dtype: string
|
71 |
+
- name: input
|
72 |
+
dtype: string
|
73 |
+
- name: output
|
74 |
+
dtype: string
|
75 |
splits:
|
76 |
- name: train
|
77 |
+
num_bytes: 238547216
|
78 |
num_examples: 39166
|
79 |
- name: validation
|
80 |
+
num_bytes: 105129508
|
81 |
num_examples: 19070
|
82 |
- name: test
|
83 |
+
num_bytes: 2998718
|
84 |
num_examples: 859
|
85 |
+
download_size: 229809783
|
86 |
+
dataset_size: 346675442
|
87 |
---
|
bugnet.py
CHANGED
@@ -28,13 +28,14 @@ def _mk_urls(language):
|
|
28 |
"validation": _URL + language + "_validation.jsonl",
|
29 |
"test": _URL + language + "_test.jsonl",
|
30 |
"descriptions": _URL + "problem_descriptions.json",
|
|
|
31 |
}
|
32 |
|
33 |
|
34 |
class Bugnet(datasets.GeneratorBasedBuilder):
|
35 |
"""TODO: Short description of my dataset."""
|
36 |
|
37 |
-
VERSION = datasets.Version("2.
|
38 |
|
39 |
BUILDER_CONFIGS = [
|
40 |
datasets.BuilderConfig(name="Python", version=VERSION, description="This part of bugnet contains Python bugs"),
|
@@ -58,6 +59,8 @@ class Bugnet(datasets.GeneratorBasedBuilder):
|
|
58 |
"error": datasets.Value("string"),
|
59 |
"stderr": datasets.Value("string"),
|
60 |
"description": datasets.Value("string"),
|
|
|
|
|
61 |
}
|
62 |
)
|
63 |
|
@@ -78,6 +81,7 @@ class Bugnet(datasets.GeneratorBasedBuilder):
|
|
78 |
gen_kwargs={
|
79 |
"filepath": data_dir["train"],
|
80 |
"descriptions": data_dir["descriptions"],
|
|
|
81 |
},
|
82 |
),
|
83 |
datasets.SplitGenerator(
|
@@ -85,6 +89,7 @@ class Bugnet(datasets.GeneratorBasedBuilder):
|
|
85 |
gen_kwargs={
|
86 |
"filepath": data_dir["validation"],
|
87 |
"descriptions": data_dir["descriptions"],
|
|
|
88 |
},
|
89 |
),
|
90 |
datasets.SplitGenerator(
|
@@ -92,20 +97,31 @@ class Bugnet(datasets.GeneratorBasedBuilder):
|
|
92 |
gen_kwargs={
|
93 |
"filepath": data_dir["test"],
|
94 |
"descriptions": data_dir["descriptions"],
|
|
|
95 |
},
|
96 |
),
|
97 |
]
|
98 |
|
99 |
-
def _generate_examples(self, filepath, descriptions):
|
100 |
with open(descriptions, encoding="utf-8") as file:
|
101 |
-
|
102 |
|
103 |
descriptions = {}
|
104 |
-
for item in
|
105 |
key = item["problem_id"]
|
106 |
value = item["description"]
|
107 |
descriptions[key] = value
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
with open(filepath, encoding="utf-8") as file:
|
110 |
for key, row in enumerate(file):
|
111 |
data = json.loads(row)
|
@@ -123,4 +139,6 @@ class Bugnet(datasets.GeneratorBasedBuilder):
|
|
123 |
"error": data["error"],
|
124 |
"stderr": data["stderr"],
|
125 |
"description": descriptions[data["problem_id"]],
|
|
|
|
|
126 |
}
|
|
|
28 |
"validation": _URL + language + "_validation.jsonl",
|
29 |
"test": _URL + language + "_test.jsonl",
|
30 |
"descriptions": _URL + "problem_descriptions.json",
|
31 |
+
"tests": _URL + "problem_tests.json",
|
32 |
}
|
33 |
|
34 |
|
35 |
class Bugnet(datasets.GeneratorBasedBuilder):
|
36 |
"""TODO: Short description of my dataset."""
|
37 |
|
38 |
+
VERSION = datasets.Version("2.1.0")
|
39 |
|
40 |
BUILDER_CONFIGS = [
|
41 |
datasets.BuilderConfig(name="Python", version=VERSION, description="This part of bugnet contains Python bugs"),
|
|
|
59 |
"error": datasets.Value("string"),
|
60 |
"stderr": datasets.Value("string"),
|
61 |
"description": datasets.Value("string"),
|
62 |
+
"input": datasets.Value("string"),
|
63 |
+
"output": datasets.Value("string"),
|
64 |
}
|
65 |
)
|
66 |
|
|
|
81 |
gen_kwargs={
|
82 |
"filepath": data_dir["train"],
|
83 |
"descriptions": data_dir["descriptions"],
|
84 |
+
"tests": data_dir["tests"],
|
85 |
},
|
86 |
),
|
87 |
datasets.SplitGenerator(
|
|
|
89 |
gen_kwargs={
|
90 |
"filepath": data_dir["validation"],
|
91 |
"descriptions": data_dir["descriptions"],
|
92 |
+
"tests": data_dir["tests"],
|
93 |
},
|
94 |
),
|
95 |
datasets.SplitGenerator(
|
|
|
97 |
gen_kwargs={
|
98 |
"filepath": data_dir["test"],
|
99 |
"descriptions": data_dir["descriptions"],
|
100 |
+
"tests": data_dir["tests"],
|
101 |
},
|
102 |
),
|
103 |
]
|
104 |
|
105 |
+
def _generate_examples(self, filepath, descriptions, tests):
|
106 |
with open(descriptions, encoding="utf-8") as file:
|
107 |
+
description_data = json.load(file)
|
108 |
|
109 |
descriptions = {}
|
110 |
+
for item in description_data:
|
111 |
key = item["problem_id"]
|
112 |
value = item["description"]
|
113 |
descriptions[key] = value
|
114 |
|
115 |
+
with open(tests, encoding="utf-8") as file:
|
116 |
+
tests_data = json.load(file)
|
117 |
+
|
118 |
+
inputs = {}
|
119 |
+
outputs = {}
|
120 |
+
for item in tests_data:
|
121 |
+
key = item["problem_id"]
|
122 |
+
inputs[key] = item["input"]
|
123 |
+
outputs[key] = item["output"]
|
124 |
+
|
125 |
with open(filepath, encoding="utf-8") as file:
|
126 |
for key, row in enumerate(file):
|
127 |
data = json.loads(row)
|
|
|
139 |
"error": data["error"],
|
140 |
"stderr": data["stderr"],
|
141 |
"description": descriptions[data["problem_id"]],
|
142 |
+
"input": inputs[data["problem_id"]],
|
143 |
+
"output": outputs[data["problem_id"]],
|
144 |
}
|