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
3eaa493e
Unverified
Commit
3eaa493e
authored
Apr 10, 2021
by
Leo Gao
Committed by
GitHub
Apr 10, 2021
Browse files
Make acc_norm a separate metric
parent
fae5fe66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
lm_eval/base.py
lm_eval/base.py
+8
-5
No files found.
lm_eval/base.py
View file @
3eaa493e
...
...
@@ -225,22 +225,25 @@ class MultipleChoiceTask(Task):
def
process_results
(
self
,
doc
,
results
):
gold
=
doc
[
"gold"
]
acc
=
1.
if
np
.
argmax
(
results
)
==
gold
else
0.
completion_len
=
np
.
array
([
float
(
len
(
i
))
for
i
in
doc
[
"choices"
]])
acc
=
1.
if
np
.
argmax
(
results
/
completion_len
)
==
gold
else
0.
acc_norm
=
1.
if
np
.
argmax
(
results
/
completion_len
)
==
gold
else
0.
return
{
"acc"
:
acc
"acc"
:
acc
,
"acc_norm"
:
acc_norm
,
}
def
higher_is_better
(
self
):
return
{
"acc"
:
True
"acc"
:
True
,
"acc_norm"
:
True
,
}
def
aggregation
(
self
):
return
{
"acc"
:
mean
"acc"
:
mean
,
"acc_norm"
:
mean
,
}
...
...
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