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
49a116ee
"example/09_convnd_fwd/convnd_fwd_xdl.cpp" did not exist on "6dfb92bbef33b4caea55f6b4ed7c449927ae771c"
Unverified
Commit
49a116ee
authored
Jul 09, 2023
by
Lintang Sutawika
Committed by
GitHub
Jul 09, 2023
Browse files
post_init to test if multple_choice has doc_to_text return list or str
parent
003c2581
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
lm_eval/api/task.py
lm_eval/api/task.py
+23
-7
No files found.
lm_eval/api/task.py
View file @
49a116ee
...
...
@@ -628,15 +628,31 @@ class ConfigurableTask(Task):
list
(
self
.
fewshot_docs
()),
self
,
rnd
=
random
.
Random
()
)
def
__post_init__
(
self
):
if
self
.
has_test_docs
():
docs
=
self
.
test_docs
()
elif
self
.
has_validation_docs
():
docs
=
self
.
validation_docs
()
else
:
assert
(
False
),
f
"Task dataset (path=
{
self
.
DATASET_PATH
}
, name=
{
self
.
DATASET_NAME
}
) must have valid or test docs!"
# Test One Doc
text_output
=
self
.
doc_to_text
()
if
type
(
text_output
)
is
list
:
self
.
multiple_input
=
True
else
self
.
multiple_input
=
False
test_doc
=
docs
[
0
]
test_text
=
self
.
doc_to_text
(
test_doc
)
if
OUTPUT_TYPE
==
"multiple_choice"
:
if
type
(
test_text
)
is
list
:
self
.
multiple_input
=
True
elif
type
(
test_text
)
is
str
:
self
.
multiple_input
=
False
test_choice
=
self
.
doc_choice
(
test_doc
)
test_target
=
self
.
doc_to_target
(
test_doc
)
doc_to_target_output
=
self
.
doc_to_target
()
doc_to_choice_output
=
self
.
doc_choice
()
def
download
(
self
,
dataset_kwargs
=
None
):
...
...
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