Spaces:
Sleeping
Sleeping
Kewen Zhao
commited on
Commit
·
53d1889
1
Parent(s):
7ddd4d3
merge inputs into references
Browse files- code_eval_stdio.py +5 -5
code_eval_stdio.py
CHANGED
|
@@ -145,8 +145,8 @@ class CodeEval(evaluate.Metric):
|
|
| 145 |
"predictions": datasets.Sequence(datasets.Value("string")),
|
| 146 |
"references": datasets.Sequence(
|
| 147 |
{
|
| 148 |
-
"
|
| 149 |
-
"
|
| 150 |
}
|
| 151 |
),
|
| 152 |
}
|
|
@@ -161,7 +161,7 @@ class CodeEval(evaluate.Metric):
|
|
| 161 |
"""
|
| 162 |
Returns the scores
|
| 163 |
predictions: List[List[str]] the python program
|
| 164 |
-
references: List[
|
| 165 |
"""
|
| 166 |
|
| 167 |
if os.getenv("HF_ALLOW_CODE_EVAL", 0) != "1":
|
|
@@ -176,9 +176,9 @@ class CodeEval(evaluate.Metric):
|
|
| 176 |
n_samples = 0
|
| 177 |
results = defaultdict(list)
|
| 178 |
|
| 179 |
-
for task_id, (candidates,
|
| 180 |
for candidate in candidates:
|
| 181 |
-
args = (candidate,
|
| 182 |
future = executor.submit(check_correctness, *args)
|
| 183 |
futures.append(future)
|
| 184 |
completion_id[task_id] += 1
|
|
|
|
| 145 |
"predictions": datasets.Sequence(datasets.Value("string")),
|
| 146 |
"references": datasets.Sequence(
|
| 147 |
{
|
| 148 |
+
"input": datasets.Value("string"),
|
| 149 |
+
"reference_output": datasets.Value("string"),
|
| 150 |
}
|
| 151 |
),
|
| 152 |
}
|
|
|
|
| 161 |
"""
|
| 162 |
Returns the scores
|
| 163 |
predictions: List[List[str]] the python program
|
| 164 |
+
references: List[Dict[str, str]] test inputs and reference outputs
|
| 165 |
"""
|
| 166 |
|
| 167 |
if os.getenv("HF_ALLOW_CODE_EVAL", 0) != "1":
|
|
|
|
| 176 |
n_samples = 0
|
| 177 |
results = defaultdict(list)
|
| 178 |
|
| 179 |
+
for task_id, (candidates, reference) in enumerate(zip(predictions, references)):
|
| 180 |
for candidate in candidates:
|
| 181 |
+
args = (candidate, reference['input'], reference['reference_output'], timeout, task_id, completion_id[task_id])
|
| 182 |
future = executor.submit(check_correctness, *args)
|
| 183 |
futures.append(future)
|
| 184 |
completion_id[task_id] += 1
|