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
8bfaaa50
Commit
8bfaaa50
authored
Oct 24, 2020
by
Anish Thite
Browse files
add triviaqa data
parent
97e5a566
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
lm_eval/tasks/triviaqa.py
lm_eval/tasks/triviaqa.py
+45
-0
No files found.
lm_eval/tasks/triviaqa.py
0 → 100644
View file @
8bfaaa50
import
json
import
random
from
lm_eval.base
import
Dataset
from
..utils
import
sh
class
TriviaQA
(
Dataset
):
def
__init__
(
self
):
self
.
download
()
def
download
(
self
):
pass
#TODO: don't download if files already there
sh
(
"""
mkdir -p data/triviaqa
wget http://nlp.cs.washington.edu/triviaqa/data/triviaqa-unfiltered.tar.gz -O data/triviaqa/trivia_qa-unfiltered.tar.gz
tar -xf data/triviaqa/trivia_qa-unfiltered.tar.gz
mv triviaqa-unfiltered/ data/triviaqa/
"""
)
def
has_training_docs
(
self
):
return
True
def
has_validation_docs
(
self
):
return
True
def
has_test_docs
(
self
):
return
True
def
training_docs
(
self
):
return
json
.
load
(
open
(
'data/triviaqa/triviaqa-unfiltered/unfiltered-web-train.json'
))[
'Data'
]
def
validation_docs
(
self
):
return
json
.
load
(
open
(
'data/triviaqa/triviaqa-unfiltered/unfiltered-web-dev.json'
))[
'Data'
]
def
test_docs
(
self
):
return
json
.
load
(
open
(
'data/triviaqa/triviaqa-unfiltered/unfiltered-web-test.json'
))[
'Data'
]
def
fewshot_description
(
self
):
pass
def
doc_to_text
(
self
,
doc
,
include_target
=
True
):
return
''
.
join
([
'Q: '
,
doc
[
'Question'
],
'
\n\n
'
,
'A: '
,
doc
[
'Answer'
][
'Aliases'
][
0
]])
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