Spaces:
Sleeping
Sleeping
Kewen Zhao
commited on
Commit
·
7e44765
1
Parent(s):
af3f724
update naming
Browse files- code_eval_stdio.py +8 -3
code_eval_stdio.py
CHANGED
@@ -152,8 +152,13 @@ class CodeEval(evaluate.Metric):
|
|
152 |
license=_LICENSE,
|
153 |
)
|
154 |
|
155 |
-
def _compute(self,
|
156 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
if os.getenv("HF_ALLOW_CODE_EVAL", 0) != "1":
|
159 |
raise ValueError(_WARNING)
|
@@ -167,7 +172,7 @@ class CodeEval(evaluate.Metric):
|
|
167 |
n_samples = 0
|
168 |
results = defaultdict(list)
|
169 |
|
170 |
-
for task_id, (candidates, inputs, outputs) in enumerate(zip(
|
171 |
for candidate in candidates:
|
172 |
args = (candidate, inputs, outputs, timeout, task_id, completion_id[task_id])
|
173 |
future = executor.submit(check_correctness, *args)
|
|
|
152 |
license=_LICENSE,
|
153 |
)
|
154 |
|
155 |
+
def _compute(self, predictions, references, inputs, k=[1, 10, 100], num_workers=4, timeout=3.0):
|
156 |
+
"""
|
157 |
+
Returns the scores
|
158 |
+
predictions: List[List[str]] the python program
|
159 |
+
references: List[str] test output
|
160 |
+
inputs: List[str] test input
|
161 |
+
"""
|
162 |
|
163 |
if os.getenv("HF_ALLOW_CODE_EVAL", 0) != "1":
|
164 |
raise ValueError(_WARNING)
|
|
|
172 |
n_samples = 0
|
173 |
results = defaultdict(list)
|
174 |
|
175 |
+
for task_id, (candidates, inputs, outputs) in enumerate(zip(predictions, inputs, references)):
|
176 |
for candidate in candidates:
|
177 |
args = (candidate, inputs, outputs, timeout, task_id, completion_id[task_id])
|
178 |
future = executor.submit(check_correctness, *args)
|