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
3be0916c
Commit
3be0916c
authored
May 17, 2024
by
lintangsutawika
Browse files
fix config passing issues
parent
104292ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
43 deletions
+26
-43
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+26
-43
No files found.
lm_eval/tasks/__init__.py
View file @
3be0916c
...
@@ -166,26 +166,16 @@ class TaskManager:
...
@@ -166,26 +166,16 @@ class TaskManager:
return
group_name
,
subtask_list
return
group_name
,
subtask_list
def
_process_group_config
(
config
,
update_config
=
None
):
def
_process_group_config
(
config
,
update_config
=
None
):
_update_config
=
None
if
update_config
is
not
None
:
if
set
(
config
.
keys
())
>
{
"task"
,
"group"
}:
config
=
{
**
config
,
**
update_config
}
_update_config
=
{
_update_config
=
{
k
:
v
for
k
,
v
in
config
.
items
()
if
k
not
in
GROUP_ONLY_KEYS
k
:
v
for
k
,
v
in
config
.
items
()
if
k
not
in
GROUP_ONLY_KEYS
}
}
if
not
bool
(
_update_config
):
if
not
bool
(
_update_config
):
_update_config
=
None
_update_config
=
None
if
_update_config
is
not
None
:
if
update_config
is
not
None
:
update_config
=
{
**
_update_config
,
**
update_config
,
}
else
:
update_config
=
_update_config
group_config
=
{
k
:
v
for
k
,
v
in
config
.
items
()
if
k
in
GROUP_ONLY_KEYS
}
group_config
=
{
k
:
v
for
k
,
v
in
config
.
items
()
if
k
in
GROUP_ONLY_KEYS
}
return
group_config
,
_update_config
return
group_config
,
update_config
if
isinstance
(
name_or_config
,
str
):
if
isinstance
(
name_or_config
,
str
):
if
update_config
is
not
None
:
if
update_config
is
not
None
:
...
@@ -208,34 +198,27 @@ class TaskManager:
...
@@ -208,34 +198,27 @@ class TaskManager:
)
)
if
isinstance
(
name_or_config
,
dict
):
if
isinstance
(
name_or_config
,
dict
):
if
update_config
is
not
None
:
name_or_config
=
{
**
name_or_config
,
**
update_config
,
}
if
self
.
_config_is_task
(
name_or_config
):
if
self
.
_config_is_task
(
name_or_config
):
name
=
name_or_config
[
"task"
]
name
=
name_or_config
.
pop
(
"task"
)
if
update_config
is
not
None
:
name_or_config
=
{
**
name_or_config
,
**
update_config
}
# If the name is registered as a group
# If the name is registered as a group
if
self
.
_name_is_group
(
name
)
or
self
.
_name_is_tag
(
name
):
if
self
.
_name_is_group
(
name
):
update_config
=
{
group_config
=
self
.
_get_config
(
name
)
k
:
v
for
k
,
v
in
name_or_config
.
items
()
group_config
,
update_config
=
_process_group_config
(
if
k
not
in
GROUP_ONLY_KEYS
+
[
"task"
,
"group"
]
group_config
,
name_or_config
}
)
group_name
,
subtask_list
=
_get_group_and_subtask_from_config
(
group_config
)
elif
self
.
_name_is_tag
(
name
):
subtask_list
=
self
.
_get_tasklist
(
name
)
subtask_list
=
self
.
_get_tasklist
(
name
)
if
subtask_list
==
-
1
:
fn
=
partial
(
group_config
=
self
.
_get_config
(
name
)
self
.
_load_individual_task_or_group
,
group_config
,
update_config
=
_process_group_config
(
update_config
=
name_or_config
,
group_config
)
)
return
dict
(
collections
.
ChainMap
(
*
map
(
fn
,
reversed
(
subtask_list
))))
group_name
,
subtask_list
=
_get_group_and_subtask_from_config
(
group_config
)
else
:
group_name
=
ConfigurableGroup
(
config
=
{
"group"
:
name
,
"task"
:
subtask_list
}
)
else
:
else
:
if
self
.
_name_is_registered
(
name
):
if
self
.
_name_is_registered
(
name
):
base_task_config
=
self
.
_get_config
(
name
)
base_task_config
=
self
.
_get_config
(
name
)
...
...
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