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
3aff8606
Commit
3aff8606
authored
Dec 12, 2022
by
jon-tow
Browse files
Run pre-commit
parent
299e9505
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
lm_eval/datasets/triviaqa/triviaqa.py
lm_eval/datasets/triviaqa/triviaqa.py
+7
-3
No files found.
lm_eval/datasets/triviaqa/triviaqa.py
View file @
3aff8606
...
@@ -100,14 +100,18 @@ class Triviaqa(datasets.GeneratorBasedBuilder):
...
@@ -100,14 +100,18 @@ class Triviaqa(datasets.GeneratorBasedBuilder):
name
=
datasets
.
Split
.
TRAIN
,
name
=
datasets
.
Split
.
TRAIN
,
# These kwargs will be passed to _generate_examples
# These kwargs will be passed to _generate_examples
gen_kwargs
=
{
gen_kwargs
=
{
"filepath"
:
os
.
path
.
join
(
data_dir
,
"triviaqa-unfiltered"
,
"unfiltered-web-train.json"
),
"filepath"
:
os
.
path
.
join
(
data_dir
,
"triviaqa-unfiltered"
,
"unfiltered-web-train.json"
),
},
},
),
),
datasets
.
SplitGenerator
(
datasets
.
SplitGenerator
(
name
=
datasets
.
Split
.
VALIDATION
,
name
=
datasets
.
Split
.
VALIDATION
,
# These kwargs will be passed to _generate_examples
# These kwargs will be passed to _generate_examples
gen_kwargs
=
{
gen_kwargs
=
{
"filepath"
:
os
.
path
.
join
(
data_dir
,
"triviaqa-unfiltered"
,
"unfiltered-web-dev.json"
),
"filepath"
:
os
.
path
.
join
(
data_dir
,
"triviaqa-unfiltered"
,
"unfiltered-web-dev.json"
),
},
},
),
),
]
]
...
@@ -115,7 +119,7 @@ class Triviaqa(datasets.GeneratorBasedBuilder):
...
@@ -115,7 +119,7 @@ class Triviaqa(datasets.GeneratorBasedBuilder):
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
def
_generate_examples
(
self
,
filepath
):
def
_generate_examples
(
self
,
filepath
):
with
open
(
filepath
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
filepath
,
encoding
=
"utf-8"
)
as
f
:
json_data
=
json
.
load
(
f
)[
'
Data
'
]
json_data
=
json
.
load
(
f
)[
"
Data
"
]
for
key
,
data
in
enumerate
(
json_data
):
for
key
,
data
in
enumerate
(
json_data
):
search_results
=
[]
search_results
=
[]
for
search_result
in
data
[
"SearchResults"
]:
for
search_result
in
data
[
"SearchResults"
]:
...
...
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