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
5971f2ca
Commit
5971f2ca
authored
Jun 04, 2024
by
lintangsutawika
Browse files
allow doc_to_text to be list and load a task for each doc_to_text variation
parent
4eeb8715
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+22
-0
No files found.
lm_eval/tasks/__init__.py
View file @
5971f2ca
...
...
@@ -183,6 +183,17 @@ class TaskManager:
name_or_config
=
{
"task"
:
name_or_config
,
**
update_config
}
elif
self
.
_name_is_task
(
name_or_config
):
task_config
=
self
.
_get_config
(
name_or_config
)
doc_to_text
=
task_config
.
get
(
"doc_to_text"
,
None
)
if
isinstance
(
doc_to_text
,
list
):
_task_list
=
{}
for
idx
,
_doc_to_text
in
enumerate
(
doc_to_text
):
_task_config
=
task_config
.
copy
()
_task_config
[
"doc_to_text"
]
=
_doc_to_text
_task_list
=
{
**
_task_list
,
**
_load_task
(
_task_config
,
task
=
f
"
{
name_or_config
}
-
{
idx
}
"
)
}
return
_task_list
return
_load_task
(
task_config
,
task
=
name_or_config
)
else
:
subtask_list
=
self
.
_get_tasklist
(
name_or_config
)
...
...
@@ -243,6 +254,17 @@ class TaskManager:
}
else
:
task_config
=
name_or_config
doc_to_text
=
task_config
.
get
(
"doc_to_text"
,
None
)
if
isinstance
(
doc_to_text
,
list
):
_task_list
=
{}
for
idx
,
_doc_to_text
in
enumerate
(
doc_to_text
):
_task_config
=
task_config
.
copy
()
_task_config
[
"doc_to_text"
]
=
_doc_to_text
_task_list
=
{
**
_task_list
,
**
_load_task
(
_task_config
,
task
=
f
"
{
name
}
-
{
idx
}
"
)
}
return
_task_list
return
_load_task
(
task_config
,
task
=
name
)
else
:
group_config
,
update_config
=
_process_group_config
(
name_or_config
)
...
...
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