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
e786cbac
Commit
e786cbac
authored
May 15, 2023
by
lintangsutawika
Browse files
detect if doc_to_x is a function
parent
cbbe3b23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
lm_eval/api/task.py
lm_eval/api/task.py
+2
-6
No files found.
lm_eval/api/task.py
View file @
e786cbac
...
@@ -444,11 +444,9 @@ class ConfigurableTask(Task):
...
@@ -444,11 +444,9 @@ class ConfigurableTask(Task):
self
.
OUTPUT_TYPE
=
self
.
_config
.
output_type
self
.
OUTPUT_TYPE
=
self
.
_config
.
output_type
if
self
.
_config
.
dataset_path
is
not
None
:
if
self
.
_config
.
dataset_path
is
not
None
:
print
(
self
.
_config
.
dataset_path
)
self
.
DATASET_PATH
=
self
.
_config
.
dataset_path
self
.
DATASET_PATH
=
self
.
_config
.
dataset_path
if
self
.
_config
.
dataset_name
is
not
None
:
if
self
.
_config
.
dataset_name
is
not
None
:
print
(
self
.
_config
.
dataset_name
)
self
.
DATASET_NAME
=
self
.
_config
.
dataset_name
self
.
DATASET_NAME
=
self
.
_config
.
dataset_name
if
self
.
_config
.
metric_list
is
not
None
:
if
self
.
_config
.
metric_list
is
not
None
:
...
@@ -553,12 +551,10 @@ class ConfigurableTask(Task):
...
@@ -553,12 +551,10 @@ class ConfigurableTask(Task):
doc_to_text
=
get_prompt
(
self
.
_config
.
use_prompt
)
doc_to_text
=
get_prompt
(
self
.
_config
.
use_prompt
)
else
:
else
:
doc_to_text
=
self
.
_config
.
doc_to_text
doc_to_text
=
self
.
_config
.
doc_to_text
print
(
doc_to_text
)
if
type
(
doc_to_text
)
==
str
:
if
type
(
doc_to_text
)
==
str
:
return
utils
.
apply_template
(
doc_to_text
,
doc
)
return
utils
.
apply_template
(
doc_to_text
,
doc
)
elif
typ
e
(
doc_to_text
)
==
Callable
:
elif
callabl
e
(
doc_to_text
):
return
doc_to_text
(
doc
)
return
doc_to_text
(
doc
)
else
:
else
:
raise
TypeError
raise
TypeError
...
@@ -567,7 +563,7 @@ class ConfigurableTask(Task):
...
@@ -567,7 +563,7 @@ class ConfigurableTask(Task):
doc_to_target
=
self
.
_config
.
doc_to_target
doc_to_target
=
self
.
_config
.
doc_to_target
if
type
(
doc_to_target
)
==
str
:
if
type
(
doc_to_target
)
==
str
:
return
utils
.
apply_template
(
doc_to_target
,
doc
)
return
utils
.
apply_template
(
doc_to_target
,
doc
)
elif
typ
e
(
doc_to_target
)
==
Callable
:
elif
callabl
e
(
doc_to_target
):
return
doc_to_target
(
doc
)
return
doc_to_target
(
doc
)
else
:
else
:
raise
TypeError
raise
TypeError
...
...
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