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
702d86aa
Commit
702d86aa
authored
Jan 20, 2024
by
lintangsutawika
Browse files
adapted initialize_tasks
parent
28cc5b6e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+20
-16
No files found.
lm_eval/tasks/__init__.py
View file @
702d86aa
...
...
@@ -12,7 +12,6 @@ from lm_eval.api.registry import (
register_group
,
TASK_REGISTRY
,
GROUP_REGISTRY
,
self
.
ALL_TASKS
,
)
import
logging
...
...
@@ -44,11 +43,29 @@ class TaskManager(abc.ABC):
include_path
=
None
)
->
None
:
self
.
ALL_TASKS
=
initialize_tasks
(
verbosity
=
verbosity
,
self
.
verbosity
=
verbosity
self
.
include_path
=
include_path
self
.
eval_logger
.
setLevel
(
getattr
(
logging
,
f
"
{
verbosity
}
"
))
self
.
ALL_TASKS
=
self
.
initialize_tasks
(
include_path
=
include_path
)
def
initialize_tasks
(
self
,
include_path
=
None
):
all_paths
=
[
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
+
"/"
]
if
include_path
is
not
None
:
if
isinstance
(
include_path
,
str
):
include_path
=
[
include_path
]
all_paths
.
extend
(
include_path
)
ALL_TASKS
=
{}
for
task_dir
in
all_paths
:
tasks
=
get_task_and_group
(
task_dir
)
ALL_TASKS
=
{
**
tasks
,
**
ALL_TASKS
}
return
ALL_TASKS
@
property
def
all_tasks
(
self
):
return
sorted
(
self
.
ALL_TASKS
.
keys
())
...
...
@@ -377,20 +394,7 @@ def get_task_and_group(task_dir: str):
return
tasks_and_groups
def
initialize_tasks
(
verbosity
=
"INFO"
,
include_path
=
None
):
eval_logger
.
setLevel
(
getattr
(
logging
,
f
"
{
verbosity
}
"
))
all_paths
=
[
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
+
"/"
]
if
include_path
is
not
None
:
if
isinstance
(
include_path
,
str
):
include_path
=
[
include_path
]
all_paths
.
extend
(
include_path
)
self
.
ALL_TASKS
=
{}
for
task_dir
in
all_paths
:
tasks
=
get_task_and_group
(
task_dir
)
self
.
ALL_TASKS
=
{
**
tasks
,
**
self
.
ALL_TASKS
}
return
self
.
ALL_TASKS
def
get_task
(
task_name
,
config
):
try
:
...
...
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