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
6fc2e148
Commit
6fc2e148
authored
Jul 06, 2023
by
haileyschoelkopf
Browse files
revert change to template_aliases
parent
e8702f15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
lm_eval/api/task.py
lm_eval/api/task.py
+10
-10
No files found.
lm_eval/api/task.py
View file @
6fc2e148
...
...
@@ -43,7 +43,7 @@ ALL_OUTPUT_TYPES = [
"multiple_choice"
,
"loglikelihood_rolling"
,
"greedy_until"
,
"winograd_schema"
"winograd_schema"
,
]
...
...
@@ -91,7 +91,7 @@ class TaskConfig(dict):
# allow user-specified aliases so that users can
# force prompt-compatibility for some prompt regardless of
# field names in prompt
if
type
(
self
.
template_aliases
)
==
str
:
if
self
.
template_aliases
:
if
type
(
self
.
doc_to_text
)
==
str
:
self
.
doc_to_text
=
self
.
template_aliases
+
self
.
doc_to_text
...
...
@@ -299,14 +299,14 @@ class Task(abc.ABC):
The processed version of the specified `doc`.
"""
return
doc
def
create_choices
(
self
,
doc
):
if
self
.
_config
.
create_choices
is
None
:
return
ast
.
literal_eval
(
utils
.
apply_template
(
self
.
_config
.
template_aliases
+
"{{answer_choices}}"
,
doc
)
)
utils
.
apply_template
(
self
.
_config
.
template_aliases
+
"{{answer_choices}}"
,
doc
)
)
elif
type
(
self
.
_config
.
create_choices
)
==
str
:
return
utils
.
apply_template
(
self
.
_config
.
create_choices
,
doc
)
else
:
...
...
@@ -743,7 +743,7 @@ class ConfigurableTask(Task):
# we pass the user-defined answer_choices var (in aliases) and translate the result to a Python list.
# TODO: any cleaner way to do this?
choices
=
self
.
create_choices
(
doc
)
request_list
=
[
Instance
(
request_type
=
"loglikelihood"
,
...
...
@@ -785,7 +785,7 @@ class ConfigurableTask(Task):
contexts
=
self
.
create_choices
(
doc
)
choice
=
self
.
doc_to_target
(
doc
)
request_list
=
[
Instance
(
request_type
=
"loglikelihood"
,
...
...
@@ -796,7 +796,7 @@ class ConfigurableTask(Task):
)
for
i
,
context
in
enumerate
(
contexts
)
]
return
request_list
return
Instance
(
...
...
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