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
3473ea80
Unverified
Commit
3473ea80
authored
Jun 22, 2021
by
Leo Gao
Committed by
GitHub
Jun 22, 2021
Browse files
Merge pull request #206 from jon-tow/mutual-fix
Fix `MuTual` loglikelihood request bug
parents
6fa1a4fa
0fec4555
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
3 deletions
+7
-3
lm_eval/tasks/mutual.py
lm_eval/tasks/mutual.py
+3
-3
tests/testdata/mutual-v1-loglikelihood
tests/testdata/mutual-v1-loglikelihood
+1
-0
tests/testdata/mutual-v1-res.json
tests/testdata/mutual-v1-res.json
+1
-0
tests/testdata/mutual_plus-v1-loglikelihood
tests/testdata/mutual_plus-v1-loglikelihood
+1
-0
tests/testdata/mutual_plus-v1-res.json
tests/testdata/mutual_plus-v1-res.json
+1
-0
No files found.
lm_eval/tasks/mutual.py
View file @
3473ea80
...
@@ -21,7 +21,7 @@ from best_download import download_file
...
@@ -21,7 +21,7 @@ from best_download import download_file
class
MuTualBase
(
Task
):
class
MuTualBase
(
Task
):
VERSION
=
0
VERSION
=
1
BASE_PATH
=
Path
(
"data/mutual"
)
BASE_PATH
=
Path
(
"data/mutual"
)
DATASET_NAME
=
None
DATASET_NAME
=
None
CHOICES
=
[
'A'
,
'B'
,
'C'
,
'D'
]
CHOICES
=
[
'A'
,
'B'
,
'C'
,
'D'
]
...
@@ -55,7 +55,7 @@ class MuTualBase(Task):
...
@@ -55,7 +55,7 @@ class MuTualBase(Task):
return
False
return
False
def
_load_docs
(
self
,
path
):
def
_load_docs
(
self
,
path
):
for
file
in
path
.
iterdir
():
for
file
in
sorted
(
path
.
iterdir
()
)
:
if
file
.
suffix
!=
".txt"
:
if
file
.
suffix
!=
".txt"
:
continue
continue
with
open
(
file
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
with
open
(
file
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
...
@@ -83,7 +83,7 @@ class MuTualBase(Task):
...
@@ -83,7 +83,7 @@ class MuTualBase(Task):
def
construct_requests
(
self
,
doc
,
ctx
):
def
construct_requests
(
self
,
doc
,
ctx
):
lls
=
[]
lls
=
[]
for
option
in
doc
[
"options"
]:
for
option
in
doc
[
"options"
]:
lls
.
append
(
rf
.
loglikelihood
(
ctx
,
f
"
{
self
.
detokenize
(
option
)
}
"
))
lls
.
append
(
rf
.
loglikelihood
(
ctx
,
f
"
{
self
.
detokenize
(
option
)
}
"
)
[
0
]
)
return
lls
return
lls
def
detokenize
(
self
,
text
):
def
detokenize
(
self
,
text
):
...
...
tests/testdata/mutual-v1-loglikelihood
0 → 100644
View file @
3473ea80
f759213a28f0412510bf1a24c9cab0dae64bdee902d42a26225295445e7779db
\ No newline at end of file
tests/testdata/mutual-v1-res.json
0 → 100644
View file @
3473ea80
{
"results"
:
{
"mutual"
:
{
"mrr"
:
0.5023513920240772
,
"mrr_stderr"
:
0.009501864812936679
,
"r@1"
:
0.22460496613995484
,
"r@1_stderr"
:
0.014028122493992806
,
"r@2"
:
0.4706546275395034
,
"r@2_stderr"
:
0.016778343895001414
}},
"versions"
:
{
"mutual"
:
1
}}
\ No newline at end of file
tests/testdata/mutual_plus-v1-loglikelihood
0 → 100644
View file @
3473ea80
b846bb9db109535f59a93d1ce340cf09f68bdf4fed5b8decd168784220fe07fa
\ No newline at end of file
tests/testdata/mutual_plus-v1-res.json
0 → 100644
View file @
3473ea80
{
"results"
:
{
"mutual_plus"
:
{
"mrr"
:
0.5275583145221953
,
"mrr_stderr"
:
0.009940894824430708
,
"r@1"
:
0.26297968397291194
,
"r@1_stderr"
:
0.01479889176605113
,
"r@2"
:
0.5
,
"r@2_stderr"
:
0.01680731613632036
}},
"versions"
:
{
"mutual_plus"
:
1
}}
\ No newline at end of file
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