Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
lm-evaluation-harness
Commits
b19dff50
Commit
b19dff50
authored
Jan 16, 2021
by
thefazzer
Browse files
Refactor iteration, indentation fix
parent
432226b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
lm_eval/base.py
lm_eval/base.py
+5
-6
No files found.
lm_eval/base.py
View file @
b19dff50
...
@@ -193,15 +193,14 @@ def acc_all(items):
...
@@ -193,15 +193,14 @@ def acc_all(items):
question_scoring_dict
=
{}
question_scoring_dict
=
{}
preds
=
list
(
zip
(
*
items
))[
0
]
preds
=
list
(
zip
(
*
items
))[
0
]
docs
=
list
(
zip
(
*
items
))[
1
]
docs
=
list
(
zip
(
*
items
))[
1
]
for
num
in
range
(
0
,
len
(
preds
)
-
1
):
doc
=
docs
[
num
]
for
(
doc
,
pred
)
in
zip
(
docs
,
preds
):
pred
=
preds
[
num
]
question_id
=
doc
[
"idx"
][
"question"
]
question_id
=
doc
[
"idx"
][
"question"
]
if
question_id
not
in
question_scoring_dict
:
if
question_id
not
in
question_scoring_dict
:
question_scoring_dict
[
question_id
]
=
[]
question_scoring_dict
[
question_id
]
=
[]
gold_label
=
doc
[
"label"
]
==
1
question_scoring_dict
[
question_id
].
append
(
gold_label
==
pred
)
gold_label
=
doc
[
"label"
]
==
1
question_scoring_dict
[
question_id
].
append
(
gold_label
==
pred
)
acc
=
np
.
mean
([
int
(
all
(
x
))
for
x
in
question_scoring_dict
.
values
()])
acc
=
np
.
mean
([
int
(
all
(
x
))
for
x
in
question_scoring_dict
.
values
()])
return
acc
return
acc
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment