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
3713ec52
Commit
3713ec52
authored
Jun 27, 2023
by
lintangsutawika
Browse files
update on how yaml file is made
parent
ee098a47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
lm_eval/tasks/benchmarks/build_promptsource_tasks.py
lm_eval/tasks/benchmarks/build_promptsource_tasks.py
+40
-0
No files found.
lm_eval/tasks/benchmarks/build_promptsource_tasks.py
0 → 100644
View file @
3713ec52
import
os
import
argparse
from
lm_eval
import
utils
from
promptsource.templates
import
DatasetTemplates
def
parse_args
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--benchmark"
,
required
=
True
)
parser
.
add_argument
(
"--model_args"
,
default
=
""
)
def
main
():
args
=
parse_args
()
path
=
args
.
benchmark
yaml_path
=
""
with
open
(
path
)
as
file
:
TASK_LIST
=
file
.
readlines
()
for
dataset_name
,
subset_name
in
TASK_LIST
:
if
subset_name
is
None
:
prompts
=
DatasetTemplates
(
dataset_name
=
dataset_name
)
else
:
prompts
=
DatasetTemplates
(
dataset_name
=
dataset_name
,
subset_name
=
subset_name
)
with
open
(
os
.
path
.
join
(
yaml_path
,
"promptsource_template.yaml"
))
as
file
:
yaml_dict
=
file
.
readline
()
for
prompt_name
in
prompts
.
all_template_names
:
config_dict
=
{
"include"
:
"promptsource_template.yaml"
,
"use_prompts"
:
prompts
[
prompt_name
],
**
yaml_dict
,
}
return
config_dict
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