jjkim
commited on
Commit
·
f35f0d4
1
Parent(s):
cb0919a
fix groupby
Browse files- code_eval.py +3 -2
code_eval.py
CHANGED
@@ -212,13 +212,14 @@ class CodeEval(evaluate.Metric):
|
|
212 |
new_results = {}
|
213 |
for key, result in results.items():
|
214 |
new_result = []
|
|
|
215 |
for completion_id, group in itertools.groupby(result, key=lambda x: x[0]):
|
216 |
group = list(group)
|
217 |
new_result.append(
|
218 |
(
|
219 |
-
|
220 |
dict(
|
221 |
-
task_id=
|
222 |
passed=all(r[1]["passed"] for r in group),
|
223 |
result=[r[1]["result"] for r in group],
|
224 |
completion_id=completion_id,
|
|
|
212 |
new_results = {}
|
213 |
for key, result in results.items():
|
214 |
new_result = []
|
215 |
+
result.sort(key=lambda x: x[0])
|
216 |
for completion_id, group in itertools.groupby(result, key=lambda x: x[0]):
|
217 |
group = list(group)
|
218 |
new_result.append(
|
219 |
(
|
220 |
+
completion_id,
|
221 |
dict(
|
222 |
+
task_id=key,
|
223 |
passed=all(r[1]["passed"] for r in group),
|
224 |
result=[r[1]["result"] for r in group],
|
225 |
completion_id=completion_id,
|