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
442f843c
Commit
442f843c
authored
Feb 07, 2021
by
Leo Gao
Browse files
Add tests for {val,test}_docs determinism
parent
77d4b087
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
tests/test_tasks.py
tests/test_tasks.py
+27
-0
No files found.
tests/test_tasks.py
View file @
442f843c
...
...
@@ -22,6 +22,33 @@ def test_basic_interface(taskname, Task):
for
v
in
task
.
higher_is_better
().
values
():
assert
v
in
[
True
,
False
]
# test deterministic docs
# (don't test train because it's slow)
task2
=
Task
()
if
task
.
has_validation_docs
():
arr
=
list
(
islice
(
task
.
validation_docs
(),
100
))
arr2
=
list
(
islice
(
task2
.
validation_docs
(),
100
))
assert
arr
==
arr2
reqs
=
[
task
.
construct_requests
(
doc
,
task
.
doc_to_text
(
doc
))
for
doc
in
arr
]
reqs2
=
[
task2
.
construct_requests
(
doc
,
task2
.
doc_to_text
(
doc
))
for
doc
in
arr2
]
assert
reqs
==
reqs2
if
task
.
has_test_docs
():
arr
=
list
(
islice
(
task
.
test_docs
(),
100
))
arr2
=
list
(
islice
(
task2
.
test_docs
(),
100
))
assert
arr
==
arr2
reqs
=
[
task
.
construct_requests
(
doc
,
task
.
doc_to_text
(
doc
))
for
doc
in
arr
]
reqs2
=
[
task2
.
construct_requests
(
doc
,
task2
.
doc_to_text
(
doc
))
for
doc
in
arr2
]
assert
reqs
==
reqs2
@
pytest
.
mark
.
parametrize
(
"taskname,Task"
,
tasks
.
TASK_REGISTRY
.
items
())
def
test_documents_and_requests
(
taskname
,
Task
):
...
...
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