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
e8e4873a
"vscode:/vscode.git/clone" did not exist on "bed386f7593f555da7797614aed4775d7a786705"
Unverified
Commit
e8e4873a
authored
Dec 23, 2021
by
Stella Biderman
Committed by
GitHub
Dec 23, 2021
Browse files
Merge pull request #239 from bigscience-workshop/thomas/fix_wnli
FIX wnli
parents
df5d7cf0
a48e3cf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
lm_eval/tasks/glue.py
lm_eval/tasks/glue.py
+7
-8
No files found.
lm_eval/tasks/glue.py
View file @
e8e4873a
...
@@ -227,7 +227,7 @@ class QNLI(HFTask):
...
@@ -227,7 +227,7 @@ class QNLI(HFTask):
class
WNLI
(
HFTask
):
class
WNLI
(
HFTask
):
VERSION
=
0
VERSION
=
1
DATASET_PATH
=
"glue"
DATASET_PATH
=
"glue"
DATASET_NAME
=
"wnli"
DATASET_NAME
=
"wnli"
...
@@ -241,26 +241,25 @@ class WNLI(HFTask):
...
@@ -241,26 +241,25 @@ class WNLI(HFTask):
return
False
return
False
def
doc_to_text
(
self
,
doc
):
def
doc_to_text
(
self
,
doc
):
return
"{}
\n
Question: {} True
,
False
or Neither
?
\n
Answer:"
.
format
(
return
"{}
\n
Question: {} True
or
False?
\n
Answer:"
.
format
(
doc
[
"sentence1"
],
doc
[
"sentence1"
],
doc
[
"sentence2"
],
doc
[
"sentence2"
],
)
)
def
doc_to_target
(
self
,
doc
):
def
doc_to_target
(
self
,
doc
):
# True = entailment
# True = entailment
# False = contradiction
# False = not_entailment
# Neither = neutral
return
" {}"
.
format
({
0
:
"False"
,
1
:
"True"
}[
doc
[
"label"
]])
return
" {}"
.
format
({
0
:
"True"
,
1
:
"Neither"
,
2
:
"False"
}[
doc
[
"label"
]])
def
construct_requests
(
self
,
doc
,
ctx
):
def
construct_requests
(
self
,
doc
,
ctx
):
ll_true
,
_
=
rf
.
loglikelihood
(
ctx
,
" True"
)
ll_true
,
_
=
rf
.
loglikelihood
(
ctx
,
" True"
)
ll_neither
,
_
=
rf
.
loglikelihood
(
ctx
,
" Neither"
)
ll_false
,
_
=
rf
.
loglikelihood
(
ctx
,
" False"
)
ll_false
,
_
=
rf
.
loglikelihood
(
ctx
,
" False"
)
return
ll_true
,
ll_neither
,
ll_false
return
ll_true
,
ll_false
def
process_results
(
self
,
doc
,
results
):
def
process_results
(
self
,
doc
,
results
):
ll_true
,
ll_false
=
results
pred
=
ll_true
>
ll_false
gold
=
doc
[
"label"
]
gold
=
doc
[
"label"
]
pred
=
np
.
argmax
(
results
)
return
{
return
{
"acc"
:
pred
==
gold
"acc"
:
pred
==
gold
}
}
...
...
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