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
fd26ef16
Unverified
Commit
fd26ef16
authored
Apr 10, 2021
by
Leo Gao
Committed by
GitHub
Apr 10, 2021
Browse files
Merge pull request #172 from EleutherAI/lambada_cloze
add cloze variant of lambada task
parents
e971baac
7ba8c183
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+2
-0
lm_eval/tasks/lambada_cloze.py
lm_eval/tasks/lambada_cloze.py
+17
-0
No files found.
lm_eval/tasks/__init__.py
View file @
fd26ef16
...
...
@@ -35,6 +35,7 @@ from . import unscramble
from
.
import
logiqa
from
.
import
hendrycks_test
from
.
import
hendrycks_math
from
.
import
lambada_cloze
########################################
# Translation tasks
...
...
@@ -91,6 +92,7 @@ TASK_REGISTRY = {
"coqa"
:
coqa
.
CoQA
,
"drop"
:
drop
.
DROP
,
"lambada"
:
lambada
.
LAMBADA
,
"lambada_cloze"
:
lambada_cloze
.
LAMBADA_cloze
,
"piqa"
:
piqa
.
PiQA
,
# Science related
...
...
lm_eval/tasks/lambada_cloze.py
0 → 100644
View file @
fd26ef16
import
json
from
lm_eval.base
import
Task
,
rf
from
lm_eval.metrics
import
mean
,
perplexity
from
lm_eval.utils
import
sh
from
lm_eval.tasks.lambada
import
LAMBADA
from
best_download
import
download_file
class
LAMBADA_cloze
(
LAMBADA
):
def
doc_to_text
(
self
,
doc
):
return
doc
[
'text'
].
rsplit
(
' '
,
1
)[
0
]
+
" ____. ->"
def
doc_to_target
(
self
,
doc
):
return
" "
+
doc
[
'text'
].
rsplit
(
' '
,
1
)[
1
]
def
fewshot_description
(
self
):
return
"Fill in blank:
\n
"
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