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
70e3ed25
Commit
70e3ed25
authored
Jul 14, 2023
by
lintangsutawika
Browse files
adjustments
parent
457c4262
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
lm_eval/api/task.py
lm_eval/api/task.py
+11
-3
No files found.
lm_eval/api/task.py
View file @
70e3ed25
...
...
@@ -742,7 +742,11 @@ class ConfigurableTask(Task):
# else:
return
doc
[
doc_to_text
]
else
:
return
utils
.
apply_template
(
doc_to_text
,
doc
)
text_string
=
utils
.
apply_template
(
doc_to_text
,
doc
)
if
text_string
.
isdigit
():
return
ast
.
literal_eval
(
text_string
)
else
:
return
text_string
elif
callable
(
doc_to_text
):
return
doc_to_text
(
doc
)
# Used when applying a Promptsource template
...
...
@@ -766,7 +770,11 @@ class ConfigurableTask(Task):
# else:
return
doc
[
doc_to_target
]
else
:
return
utils
.
apply_template
(
doc_to_target
,
doc
)
target_string
=
utils
.
apply_template
(
doc_to_target
,
doc
)
if
target_string
.
isdigit
():
return
ast
.
literal_eval
(
target_string
)
else
:
return
target_string
elif
callable
(
doc_to_target
):
return
doc_to_target
(
doc
)
# Used when applying a Promptsource template
...
...
@@ -779,7 +787,7 @@ class ConfigurableTask(Task):
if
self
.
prompt
is
not
None
:
doc_to_choice
=
self
.
prompt
elif
doc_to_choice
is
None
:
elif
self
.
_config
.
doc_to_choice
is
None
:
eval_logger
.
error
(
"doc_to_choice was called but not set in config"
)
else
:
doc_to_choice
=
self
.
_config
.
doc_to_choice
...
...
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