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
8299ab3b
Commit
8299ab3b
authored
May 11, 2023
by
lintangsutawika
Browse files
process yaml and registered tasks through args.task
parent
41ec3bc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
14 deletions
+30
-14
main.py
main.py
+30
-14
No files found.
main.py
View file @
8299ab3b
...
@@ -5,7 +5,7 @@ import fnmatch
...
@@ -5,7 +5,7 @@ import fnmatch
import
yaml
import
yaml
import
os
import
os
from
lm_eval
import
evaluator
,
task
s
from
lm_eval
import
evaluator
,
util
s
from
lm_eval.tasks
import
ALL_TASKS
from
lm_eval.tasks
import
ALL_TASKS
logging
.
getLogger
(
"openai"
).
setLevel
(
logging
.
WARNING
)
logging
.
getLogger
(
"openai"
).
setLevel
(
logging
.
WARNING
)
...
@@ -68,22 +68,38 @@ def main():
...
@@ -68,22 +68,38 @@ def main():
)
)
if
args
.
tasks
is
None
:
if
args
.
tasks
is
None
:
if
args
.
config
:
if
os
.
path
.
isdir
(
args
.
tasks
):
import
glob
task_names
=
[]
task_names
=
[]
for
config_files
in
args
.
config
.
split
(
","
):
yaml_path
=
os
.
path
.
join
(
args
.
tasks
,
"*.yaml"
)
config
=
get_yaml_config
(
config_files
)
for
yaml_file
in
glob
.
glob
(
yaml_path
):
config
=
utils
.
get_yaml_config
(
yaml_file
)
if
args
.
num_fewshot
!=
0
:
config
[
"num_fewshot"
]
=
args
.
num_fewshot
if
args
.
batch_size
!=
None
:
config
[
"batch_size"
]
=
args
.
batch_size
task_names
.
append
(
config
)
task_names
.
append
(
config
)
else
:
else
:
task_names
=
ALL_TASKS
tasks_list
=
args
.
tasks
.
split
(
","
)
else
:
task_names
=
pattern_match
(
tasks_list
,
ALL_TASKS
)
task_names
=
pattern_match
(
args
.
tasks
.
split
(
","
),
ALL_TASKS
)
for
task
in
[
task
for
task
in
tasks_list
if
task
not
in
task_names
]:
if
os
.
path
.
isfile
(
task
):
config
=
utils
.
get_yaml_config
(
config_files
)
task_names
.
append
(
config
)
# # Tas
# if args.config:
# task_names = []
# for config_files in args.config.split(","):
# config = utils.get_yaml_config(config_files)
# if args.num_fewshot != 0:
# config["num_fewshot"] = args.num_fewshot
# if args.batch_size != None:
# config["batch_size"] = args.batch_size
# task_names.append(config)
# else:
# task_names = ALL_TASKS
# else:
print
(
f
"Selected Tasks:
{
task_names
}
"
)
print
(
f
"Selected Tasks:
{
task_names
}
"
)
...
...
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