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
6d1753dc
Commit
6d1753dc
authored
May 15, 2024
by
lintangsutawika
Browse files
add _process_group_config
parent
aef7028c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+24
-14
No files found.
lm_eval/tasks/__init__.py
View file @
6d1753dc
...
...
@@ -166,6 +166,24 @@ class TaskManager:
subtask_list
.
append
(
task
)
return
group_name
,
subtask_list
def
_process_group_config
(
config
):
if
set
(
config
.
keys
())
>
{
"task"
,
"group"
}:
update_config
=
{
k
:
v
for
k
,
v
in
config
.
items
()
if
k
not
in
GROUP_ONLY_KEYS
+
[
"task"
,
"group"
]
}
if
not
bool
(
update_config
):
update_config
=
None
group_config
=
{
k
:
v
for
k
,
v
in
config
.
items
()
if
k
in
GROUP_ONLY_KEYS
+
[
"task"
,
"group"
]
}
return
group_config
,
update_config
if
isinstance
(
name_or_config
,
str
):
if
update_config
is
not
None
:
# Process name_or_config as a dict instead
...
...
@@ -177,6 +195,7 @@ class TaskManager:
subtask_list
=
self
.
_get_tasklist
(
name_or_config
)
if
subtask_list
==
-
1
:
group_config
=
self
.
_get_config
(
name_or_config
)
group_config
,
update_config
=
_process_group_config
(
group_config
)
group_name
,
subtask_list
=
_get_group_and_subtask_from_config
(
group_config
)
...
...
@@ -204,12 +223,15 @@ class TaskManager:
subtask_list
=
self
.
_get_tasklist
(
name
)
if
subtask_list
==
-
1
:
group_config
=
self
.
_get_config
(
name
)
group_config
,
update_config
=
_process_group_config
(
group_config
)
group_name
,
subtask_list
=
_get_group_and_subtask_from_config
(
group_config
)
else
:
group_name
=
ConfigurableGroup
(
config
=
{
"group"
:
group_
name
,
"task"
:
subtask_list
}
config
=
{
"group"
:
name
,
"task"
:
subtask_list
}
)
else
:
if
self
.
_name_is_registered
(
name
):
...
...
@@ -238,22 +260,10 @@ class TaskManager:
task_config
=
name_or_config
return
_load_task
(
task_config
,
task
=
name
)
else
:
group_config
=
{
k
:
v
for
k
,
v
in
name_or_config
.
items
()
if
k
in
GROUP_ONLY_KEYS
+
[
"task"
,
"group"
]
}
group_config
,
update_config
=
_process_group_config
(
name_or_config
)
group_name
,
subtask_list
=
_get_group_and_subtask_from_config
(
group_config
)
if
set
(
name_or_config
.
keys
())
>
{
"task"
,
"group"
}:
update_config
=
{
k
:
v
for
k
,
v
in
name_or_config
.
items
()
if
k
not
in
GROUP_ONLY_KEYS
+
[
"task"
,
"group"
]
}
if
not
bool
(
update_config
):
update_config
=
None
fn
=
partial
(
self
.
_load_individual_task_or_group
,
...
...
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