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
79dcfa0e
Commit
79dcfa0e
authored
Jan 19, 2024
by
lintangsutawika
Browse files
changed variable names
parent
c37ced0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
20 deletions
+29
-20
lm_eval/__main__.py
lm_eval/__main__.py
+29
-20
No files found.
lm_eval/__main__.py
View file @
79dcfa0e
...
@@ -176,22 +176,24 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None:
...
@@ -176,22 +176,24 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None:
if
os
.
path
.
isdir
(
args
.
tasks
):
if
os
.
path
.
isdir
(
args
.
tasks
):
import
glob
import
glob
task_names
=
[]
loaded_task_list
=
[]
yaml_path
=
os
.
path
.
join
(
args
.
tasks
,
"*.yaml"
)
yaml_path
=
os
.
path
.
join
(
args
.
tasks
,
"*.yaml"
)
for
yaml_file
in
glob
.
glob
(
yaml_path
):
for
yaml_file
in
glob
.
glob
(
yaml_path
):
config
=
utils
.
load_yaml_config
(
yaml_file
)
config
=
utils
.
load_yaml_config
(
yaml_file
)
task_names
.
append
(
config
)
loaded_task_list
.
append
(
config
)
else
:
else
:
tasks_list
=
args
.
tasks
.
split
(
","
)
input_task_list
=
args
.
tasks
.
split
(
","
)
task_names
=
utils
.
pattern_match
(
tasks_list
,
ALL_TASKS
.
keys
())
loaded_task_list
=
utils
.
pattern_match
(
input_task_list
,
ALL_TASKS
.
keys
())
for
task
in
[
task
for
task
in
tasks_list
if
task
not
in
task_names
]:
for
task
in
[
task
for
task
in
input_task_list
if
task
not
in
loaded_task_list
]:
if
os
.
path
.
isfile
(
task
):
if
os
.
path
.
isfile
(
task
):
config
=
utils
.
load_yaml_config
(
task
)
config
=
utils
.
load_yaml_config
(
task
)
task_names
.
append
(
config
)
loaded_task_list
.
append
(
config
)
task_missing
=
[
task_missing
=
[
task
task
for
task
in
task
s
_list
for
task
in
input_
task_list
if
task
not
in
task_names
and
"*"
not
in
task
if
task
not
in
loaded_task_list
and
"*"
not
in
task
]
# we don't want errors if a wildcard ("*") task name was used
]
# we don't want errors if a wildcard ("*") task name was used
if
task_missing
:
if
task_missing
:
...
@@ -224,26 +226,33 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None:
...
@@ -224,26 +226,33 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None:
elif
args
.
log_samples
and
not
args
.
output_path
:
elif
args
.
log_samples
and
not
args
.
output_path
:
assert
args
.
output_path
,
"Specify --output_path"
assert
args
.
output_path
,
"Specify --output_path"
eval_logger
.
info
(
f
"Selected Tasks:
{
task_names
}
"
)
eval_logger
.
info
(
f
"Selected Tasks:
{
loaded_task_list
}
"
)
eval_logger
.
info
(
"Loading selected tasks..."
)
eval_logger
.
info
(
"Loading selected tasks..."
)
task_objects
=
{}
all_tasks
=
{}
for
task
in
task_names
:
for
task
in
loaded_task_list
:
task_object
=
load_task_or_group
(
ALL_TASKS
,
task_name_or_config
=
task
,
)
if
isinstance
(
task
,
str
):
if
isinstance
(
task
,
str
):
task_objects
[
task
]
=
load_task_or_group
(
task_name
=
task
ALL_TASKS
,
task_name
=
task
,
)
elif
isinstance
(
task
,
dict
):
elif
isinstance
(
task
,
dict
):
task_objects
[
task
[
"task"
]]
=
load_task_or_group
(
task_name
=
task
[
"task"
]
ALL_TASKS
,
task_config
=
task
,
if
isinstance
(
task_object
,
dict
):
)
all_tasks
=
{
**
task_object
,
**
all_tasks
}
else
:
all_tasks
[
task_name
]
=
task_object
# for key, value in all_tasks.items():
# print(key, value)
# import sys; sys.exit()
results
=
evaluator
.
simple_evaluate
(
results
=
evaluator
.
simple_evaluate
(
model
=
args
.
model
,
model
=
args
.
model
,
model_args
=
args
.
model_args
,
model_args
=
args
.
model_args
,
tasks
=
task
_object
s
,
tasks
=
all_
tasks
,
num_fewshot
=
args
.
num_fewshot
,
num_fewshot
=
args
.
num_fewshot
,
batch_size
=
args
.
batch_size
,
batch_size
=
args
.
batch_size
,
max_batch_size
=
args
.
max_batch_size
,
max_batch_size
=
args
.
max_batch_size
,
...
...
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