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
afcea267
Commit
afcea267
authored
Apr 27, 2022
by
jordiclive
Browse files
webnlg
parent
1cd4ec01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+2
-0
lm_eval/tasks/gem_webnlg.py
lm_eval/tasks/gem_webnlg.py
+37
-0
scripts/write_out.py
scripts/write_out.py
+1
-1
No files found.
lm_eval/tasks/__init__.py
View file @
afcea267
...
@@ -53,6 +53,7 @@ from . import asdiv
...
@@ -53,6 +53,7 @@ from . import asdiv
from
.
import
gsm8k
from
.
import
gsm8k
from
.
import
storycloze
from
.
import
storycloze
from
.
import
hans
from
.
import
hans
from
.
import
gem_webnlg
# from . import e2e_nlg_cleaned
# from . import e2e_nlg_cleaned
...
@@ -108,6 +109,7 @@ TASK_REGISTRY = {
...
@@ -108,6 +109,7 @@ TASK_REGISTRY = {
"wsc"
:
superglue
.
SGWinogradSchemaChallenge
,
"wsc"
:
superglue
.
SGWinogradSchemaChallenge
,
# Order by benchmark/genre?
# Order by benchmark/genre?
"coqa"
:
coqa
.
CoQA
,
"coqa"
:
coqa
.
CoQA
,
"GEM/web_nlg"
:
gem_webnlg
.
WebNLG
,
"drop"
:
drop
.
DROP
,
"drop"
:
drop
.
DROP
,
"lambada"
:
lambada
.
LAMBADA
,
"lambada"
:
lambada
.
LAMBADA
,
"lambada_cloze"
:
lambada_cloze
.
LAMBADA_cloze
,
"lambada_cloze"
:
lambada_cloze
.
LAMBADA_cloze
,
...
...
lm_eval/tasks/gem_webnlg.py
0 → 100644
View file @
afcea267
from
lm_eval.base
import
PromptSourceTask
class
WebNLG
(
PromptSourceTask
):
VERSION
=
0
DATASET_PATH
=
"GEM/web_nlg"
DATASET_NAME
=
"en"
def
has_training_docs
(
self
):
return
False
def
has_validation_docs
(
self
):
return
True
def
has_test_docs
(
self
):
return
True
def
training_docs
(
self
):
if
self
.
has_training_docs
():
if
self
.
_training_docs
is
None
:
self
.
_training_docs
=
list
(
self
.
dataset
[
"train"
])
return
self
.
_training_docs
def
validation_docs
(
self
):
if
self
.
has_validation_docs
():
return
self
.
dataset
[
"validation"
]
def
test_docs
(
self
):
if
self
.
has_test_docs
():
return
self
.
dataset
[
"test"
]
def
stopping_criteria
(
self
):
return
'*'
def
max_generation_length
(
self
):
return
250
scripts/write_out.py
View file @
afcea267
...
@@ -56,7 +56,7 @@ def main():
...
@@ -56,7 +56,7 @@ def main():
docs
=
join_iters
(
iters
)
docs
=
join_iters
(
iters
)
description
=
description_dict
[
task_name
]
if
description_dict
and
task_name
in
description_dict
else
""
description
=
description_dict
[
task_name
]
if
description_dict
and
task_name
in
description_dict
else
""
task_name
=
task_name
.
replace
(
'/'
,
'_'
)
with
open
(
os
.
path
.
join
(
args
.
output_base_path
,
task_name
),
"w"
)
as
f
:
with
open
(
os
.
path
.
join
(
args
.
output_base_path
,
task_name
),
"w"
)
as
f
:
for
i
,
doc
in
zip
(
range
(
args
.
num_examples
),
docs
)
if
args
.
num_examples
>
0
else
enumerate
(
docs
):
for
i
,
doc
in
zip
(
range
(
args
.
num_examples
),
docs
)
if
args
.
num_examples
>
0
else
enumerate
(
docs
):
f
.
write
(
EXAMPLE_DIVIDER
.
format
(
i
=
i
))
f
.
write
(
EXAMPLE_DIVIDER
.
format
(
i
=
i
))
...
...
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