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
4288792e
Commit
4288792e
authored
Jan 19, 2024
by
lintangsutawika
Browse files
load_task_or_group works but only for tasks
parent
1ed31584
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+25
-4
No files found.
lm_eval/tasks/__init__.py
View file @
4288792e
...
...
@@ -30,10 +30,31 @@ from .scrolls.task import (
eval_logger
=
utils
.
eval_logger
def
load_task_or_group
(
yaml_path
:
str
)
->
ConfigurableTask
:
def
is_group
(
task
):
if
list
(
task
.
keys
())
==
[
"group"
,
"task"
]:
return
True
return
False
config
=
utils
.
load_yaml_config
(
yaml_path
)
return
ConfigurableTask
(
config
=
config
)
def
load_task_or_group
(
ALL_TASKS
,
task_name
:
str
=
None
,
task_config
:
dict
=
None
)
->
ConfigurableTask
:
if
task_name
is
not
None
:
yaml_path
=
ALL_TASKS
[
task_name
][
"yaml_path"
]
task_type
=
ALL_TASKS
[
task_name
][
"type"
]
task_config
=
utils
.
load_yaml_config
(
yaml_path
)
else
:
assert
task_config
is
not
None
if
is_group
(
task_config
):
task_type
=
"group"
else
:
task_type
=
"task"
if
task_type
==
"task"
:
return
ConfigurableTask
(
config
=
task_config
)
# else:
# for task in task_list:
# do some recursion here.
# return (group, ConfigurableTask(config=config))
def
register_configurable_task
(
config
:
Dict
[
str
,
str
])
->
int
:
...
...
@@ -73,7 +94,7 @@ def register_configurable_group(config: Dict[str, str], yaml_path: str = None) -
for
task
in
config
[
"task"
]:
if
isinstance
(
task
,
str
):
registered_task_or_group_list
.
append
(
task
)
elif
l
is
t
(
task
.
keys
())
==
[
"
group
"
,
"
task
"
]
:
elif
is
_
group
(
task
)
:
group_config_list
.
append
(
task
)
else
:
task_config_list
.
append
(
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