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
042e2926
Commit
042e2926
authored
Oct 24, 2020
by
Anish Thite
Browse files
add storycloze
parent
0f2b9317
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
lm_eval/tasks/storycloze.py
lm_eval/tasks/storycloze.py
+47
-0
No files found.
lm_eval/tasks/storycloze.py
0 → 100644
View file @
042e2926
import
json
import
random
from
lm_eval.base
import
Dataset
from
..utils
import
sh
import
csv
class
StoryCloze
(
Dataset
):
def
__init__
(
self
):
self
.
download
()
def
download
(
self
):
#TODO: replace with Eye link
pass
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
):
pass
def
load_doc
(
self
,
filename
):
with
open
(
filename
,
newline
=
''
)
as
file
:
filereader
=
csv
.
reader
(
file
)
return
list
(
filereader
)
def
validation_docs
(
self
):
return
self
.
load_doc
(
"data/storycloze/cloze_test_val__winter2018-cloze_test_ALL_val - 1 - 1.csv"
)
def
test_docs
(
self
):
return
self
.
load_doc
(
"data/storycloze/cloze_test_test__winter2018-cloze_test_ALL_test - 1.csv"
)
def
fewshot_description
(
self
):
pass
def
doc_to_text
(
self
,
doc
,
include_target
=
True
):
return
' '
.
join
([
*
doc
[
1
:
5
],
doc
[
int
(
doc
[
-
1
])
-
4
]])
def
evaluate
(
self
,
docs
,
lm
):
pass
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