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
d7b20fe2
Unverified
Commit
d7b20fe2
authored
Mar 25, 2021
by
Leo Gao
Committed by
GitHub
Mar 25, 2021
Browse files
naturalqs: update random
parent
d42af30d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
lm_eval/tasks/naturalqs.py
lm_eval/tasks/naturalqs.py
+3
-1
No files found.
lm_eval/tasks/naturalqs.py
View file @
d7b20fe2
...
@@ -33,7 +33,9 @@ class NaturalQs(HFTask):
...
@@ -33,7 +33,9 @@ class NaturalQs(HFTask):
if
self
.
_training_docs
is
None
:
if
self
.
_training_docs
is
None
:
self
.
_training_docs
=
list
(
islice
(
self
.
training_docs
(),
0
,
100000
))
self
.
_training_docs
=
list
(
islice
(
self
.
training_docs
(),
0
,
100000
))
return
random
.
sample
(
self
.
_training_docs
,
k
)
rnd
=
random
.
Random
()
rnd
.
seed
(
42
)
return
rnd
.
sample
(
self
.
_training_docs
,
k
)
def
doc_to_text
(
self
,
doc
):
def
doc_to_text
(
self
,
doc
):
return
'Q: '
+
doc
[
'question'
][
'text'
]
+
'
\n\n
'
+
'A: '
return
'Q: '
+
doc
[
'question'
][
'text'
]
+
'
\n\n
'
+
'A: '
...
...
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