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
f60f1753
Commit
f60f1753
authored
Sep 17, 2022
by
kabbi159
Browse files
add accuracy and macro f1 score in kobest task
parent
44e4196b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
16 deletions
+44
-16
lm_eval/tasks/kobest.py
lm_eval/tasks/kobest.py
+44
-16
No files found.
lm_eval/tasks/kobest.py
View file @
f60f1753
...
...
@@ -21,7 +21,7 @@ Homepage: https://huggingface.co/datasets/skt/kobest_v1
import
numpy
as
np
from
lm_eval.base
import
MultipleChoiceTask
,
rf
,
Task
from
lm_eval.metrics
import
f1_score
,
macro_f1_score
from
lm_eval.metrics
import
f1_score
,
macro_f1_score
,
mean
class
BoolQ
(
Task
):
...
...
@@ -65,17 +65,23 @@ class BoolQ(Task):
pred
=
np
.
argmax
(
results
)
gold
=
doc
[
"label"
]
return
{
"f1"
:
(
gold
,
pred
)
"f1"
:
(
gold
,
pred
),
"acc"
:
pred
==
gold
,
"macro_f1"
:
(
gold
,
pred
)
}
def
higher_is_better
(
self
):
return
{
"f1"
:
True
"f1"
:
True
,
"acc"
:
True
,
"macro_f1"
:
True
}
def
aggregation
(
self
):
return
{
"f1"
:
f1_score
"f1"
:
f1_score
,
"acc"
:
mean
,
"macro_f1"
:
macro_f1_score
}
...
...
@@ -131,17 +137,24 @@ class COPA(Task):
pred
=
np
.
argmax
(
results
)
gold
=
doc
[
"label"
]
return
{
"f1"
:
(
gold
,
pred
)
"f1"
:
(
gold
,
pred
),
"acc"
:
pred
==
gold
,
"macro_f1"
:
(
gold
,
pred
)
}
def
higher_is_better
(
self
):
return
{
"f1"
:
True
"f1"
:
True
,
"acc"
:
True
,
"macro_f1"
:
True
}
def
aggregation
(
self
):
return
{
"f1"
:
f1_score
"f1"
:
f1_score
,
"acc"
:
mean
,
"macro_f1"
:
macro_f1_score
}
class
WiC
(
Task
):
...
...
@@ -185,17 +198,23 @@ class WiC(Task):
pred
=
np
.
argmax
(
results
)
gold
=
doc
[
"label"
]
return
{
"f1"
:
(
gold
,
pred
)
"f1"
:
(
gold
,
pred
),
"acc"
:
pred
==
gold
,
"macro_f1"
:
(
gold
,
pred
)
}
def
higher_is_better
(
self
):
return
{
"f1"
:
True
"f1"
:
True
,
"acc"
:
True
,
"macro_f1"
:
True
}
def
aggregation
(
self
):
return
{
"f1"
:
f1_score
"f1"
:
f1_score
,
"acc"
:
mean
,
"macro_f1"
:
macro_f1_score
}
...
...
@@ -239,17 +258,20 @@ class HellaSwag(MultipleChoiceTask):
pred
=
np
.
argmax
(
results
)
gold
=
doc
[
"gold"
]
return
{
"f1"
:
(
gold
,
pred
)
"acc"
:
pred
==
gold
,
"macro_f1"
:
(
gold
,
pred
)
}
def
higher_is_better
(
self
):
return
{
"f1"
:
True
"acc"
:
True
,
"macro_f1"
:
True
}
def
aggregation
(
self
):
return
{
"f1"
:
macro_f1_score
"acc"
:
mean
,
"macro_f1"
:
macro_f1_score
}
...
...
@@ -294,15 +316,21 @@ class SentiNeg(Task):
pred
=
np
.
argmax
(
results
)
gold
=
doc
[
"label"
]
return
{
"f1"
:
(
gold
,
pred
)
"f1"
:
(
gold
,
pred
),
"acc"
:
pred
==
gold
,
"macro_f1"
:
(
gold
,
pred
)
}
def
higher_is_better
(
self
):
return
{
"f1"
:
True
"f1"
:
True
,
"acc"
:
True
,
"macro_f1"
:
True
}
def
aggregation
(
self
):
return
{
"f1"
:
f1_score
"f1"
:
f1_score
,
"acc"
:
mean
,
"macro_f1"
:
macro_f1_score
}
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