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
4a0a8bd8
"mmdet/vscode:/vscode.git/clone" did not exist on "5686a37548cc20fc1242a78ef6dd993312eebdfd"
Commit
4a0a8bd8
authored
Jul 25, 2025
by
Baber
Browse files
fix
parent
c40a012a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+16
-11
tests/test_taskmanager.py
tests/test_taskmanager.py
+3
-3
No files found.
lm_eval/tasks/__init__.py
View file @
4a0a8bd8
...
...
@@ -567,23 +567,27 @@ class TaskManager:
and
self
.
task_index
[
name
][
"type"
]
==
"python_task"
)
def
_config_is_task
(
self
,
config
:
dict
)
->
bool
:
@
staticmethod
def
_config_is_task
(
config
:
dict
)
->
bool
:
"""Check if a config dictionary defines a single task."""
return
"task"
in
config
and
isinstance
(
config
[
"task"
],
str
)
def
_config_is_group
(
self
,
config
:
dict
)
->
bool
:
@
staticmethod
def
_config_is_group
(
config
:
dict
)
->
bool
:
"""Check if a config dictionary defines a group of tasks."""
return
"task"
in
config
and
isinstance
(
config
[
"task"
],
list
)
def
_config_is_python_task
(
self
,
config
:
dict
)
->
bool
:
@
staticmethod
def
_config_is_python_task
(
config
:
dict
)
->
bool
:
"""Check if a config dictionary defines a Python class-based task."""
return
"class"
in
config
def
_config_is_task_list
(
self
,
config
:
dict
)
->
bool
:
@
staticmethod
def
_config_is_task_list
(
config
:
dict
)
->
bool
:
"""Check if a config dictionary defines a task list."""
return
"task_list"
in
config
and
isinstance
(
config
[
"task_list"
],
list
)
def
_get_yaml_path
(
self
,
name
:
str
)
->
Union
[
str
,
int
]:
def
_get_yaml_path
(
self
,
name
:
str
)
->
Union
[
str
,
int
,
list
[
str
]
]:
"""
Get the YAML file path for a registered task.
...
...
@@ -645,7 +649,7 @@ class TaskManager:
yaml_path
:
str
,
tasks_and_groups
:
dict
[
str
,
dict
],
config
:
Optional
[
dict
]
=
None
,
populate_tags_fn
:
Optional
[
c
allable
]
=
None
,
populate_tags_fn
:
Optional
[
C
allable
]
=
None
,
)
->
None
:
"""Helper method to register a task in the tasks_and_groups dict"""
tasks_and_groups
[
task_name
]
=
{
...
...
@@ -779,11 +783,12 @@ class TaskManager:
grp
=
GroupConfig
(
**
cfg
)
subtasks
:
list
[
Union
[
str
,
dict
]]
=
[]
for
t
in
grp
.
task
:
if
isinstance
(
t
,
str
)
and
self
.
_name_is_tag
(
t
):
subtasks
.
extend
(
self
.
_get_tasklist
(
t
))
else
:
subtasks
.
append
(
t
)
if
grp
.
task
:
for
t
in
grp
.
task
:
if
isinstance
(
t
,
str
)
and
self
.
_name_is_tag
(
t
):
subtasks
.
extend
(
self
.
_get_tasklist
(
t
))
else
:
subtasks
.
append
(
t
)
return
grp
,
subtasks
def
_load_subtasks
(
...
...
tests/test_taskmanager.py
View file @
4a0a8bd8
...
...
@@ -173,18 +173,18 @@ class TestWalkthroughConfigs:
# Test config detection methods
assert
self
.
tm
.
_config_is_task
(
configs
[
0
])
assert
not
self
.
tm
.
_config_is_group
(
configs
[
0
]
)
assert
not
self
.
tm
.
_config_is_group
()
assert
not
self
.
tm
.
_config_is_task_list
(
configs
[
0
])
assert
not
self
.
tm
.
_config_is_task
(
configs
[
1
])
assert
self
.
tm
.
_config_is_group
(
configs
[
1
]
)
assert
self
.
tm
.
_config_is_group
()
assert
not
self
.
tm
.
_config_is_task_list
(
configs
[
1
])
# Test task_list detection with actual config
task_list_config
=
{
"task_list"
:
[{
"task"
:
"task1"
},
{
"task"
:
"task2"
}]}
assert
self
.
tm
.
_config_is_task_list
(
task_list_config
)
assert
not
self
.
tm
.
_config_is_task
(
task_list_config
)
assert
not
self
.
tm
.
_config_is_group
(
task_list_config
)
assert
not
self
.
tm
.
_config_is_group
()
if
__name__
==
"__main__"
:
...
...
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