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
1964ccd3
Commit
1964ccd3
authored
Oct 20, 2023
by
Michael Pieler
Browse files
feat: add --include_path option to write out
parent
408115ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
scripts/write_out.py
scripts/write_out.py
+14
-4
No files found.
scripts/write_out.py
View file @
1964ccd3
...
@@ -2,9 +2,9 @@ import argparse
...
@@ -2,9 +2,9 @@ import argparse
import
numpy
as
np
import
numpy
as
np
import
json
import
json
import
os
import
os
import
random
from
lm_eval
import
tasks
from
lm_eval.utils
import
join_iters
from
lm_eval.utils
import
join_iters
from
lm_eval.tasks
import
include_path
from
lm_eval.logger
import
eval_logger
EXAMPLE_DIVIDER
=
"!!@@##@@!! -- Example {i}
\n
"
EXAMPLE_DIVIDER
=
"!!@@##@@!! -- Example {i}
\n
"
...
@@ -17,6 +17,12 @@ def parse_args():
...
@@ -17,6 +17,12 @@ def parse_args():
parser
.
add_argument
(
"--num_fewshot"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"--num_fewshot"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"--seed"
,
type
=
int
,
default
=
42
)
parser
.
add_argument
(
"--seed"
,
type
=
int
,
default
=
42
)
parser
.
add_argument
(
"--num_examples"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"--num_examples"
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
"--include_path"
,
type
=
str
,
default
=
None
,
help
=
"Additional path to include if there are external tasks to include."
,
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
...
@@ -24,13 +30,17 @@ def main():
...
@@ -24,13 +30,17 @@ def main():
args
=
parse_args
()
args
=
parse_args
()
np
.
random
.
seed
(
args
.
seed
)
np
.
random
.
seed
(
args
.
seed
)
if
args
.
include_path
is
not
None
:
eval_logger
.
info
(
f
"Including path:
{
args
.
include_path
}
"
)
include_path
(
args
.
include_path
)
if
args
.
tasks
==
"all_tasks"
:
if
args
.
tasks
==
"all_tasks"
:
task_names
=
tasks
.
ALL_TASKS
task_names
=
tasks
.
ALL_TASKS
else
:
else
:
task_names
=
args
.
tasks
.
split
(
","
)
task_names
=
args
.
tasks
.
split
(
","
)
task_dict
=
tasks
.
get_task_dict
(
task_names
)
task_dict
=
tasks
.
get_task_dict
(
task_names
)
os
.
makedirs
(
args
.
output_base_path
,
exist_ok
=
True
)
os
.
makedirs
(
args
.
output_base_path
,
exist_ok
=
True
)
for
task_name
,
task
in
task_dict
.
items
():
for
task_name
,
task
in
task_dict
.
items
():
rnd
=
random
.
Random
()
rnd
=
random
.
Random
()
rnd
.
seed
(
args
.
seed
)
rnd
.
seed
(
args
.
seed
)
...
...
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