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
f1d251ca
Commit
f1d251ca
authored
Jun 13, 2023
by
FarzanehNakhaee
Browse files
Update output path for the example logger
parent
5a766ac5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
main.py
main.py
+12
-10
No files found.
main.py
View file @
f1d251ca
...
@@ -10,6 +10,7 @@ from lm_eval.logger import eval_logger
...
@@ -10,6 +10,7 @@ from lm_eval.logger import eval_logger
os
.
environ
[
"TOKENIZERS_PARALLELISM"
]
=
"false"
os
.
environ
[
"TOKENIZERS_PARALLELISM"
]
=
"false"
ALL_TASKS
=
sorted
(
list
(
TASK_REGISTRY
.
keys
())
+
list
(
GROUP_REGISTRY
.
keys
()))
ALL_TASKS
=
sorted
(
list
(
TASK_REGISTRY
.
keys
())
+
list
(
GROUP_REGISTRY
.
keys
()))
print
(
"ALL tasks: "
,
ALL_TASKS
)
class
MultiChoice
:
class
MultiChoice
:
def
__init__
(
self
,
choices
):
def
__init__
(
self
,
choices
):
...
@@ -59,19 +60,19 @@ def pattern_match(patterns, source_list):
...
@@ -59,19 +60,19 @@ def pattern_match(patterns, source_list):
task_names
.
add
(
matching
)
task_names
.
add
(
matching
)
return
sorted
(
list
(
task_names
))
return
sorted
(
list
(
task_names
))
def
setup_example_logger
(
output_path
,
separator
):
def
setup_example_logger
(
output_path
):
"""Sets up a logger that will save each example and prediction."""
"""Sets up a logger that will save each example and prediction."""
example_logger
=
logging
.
getLogger
(
"examples"
)
example_logger
=
logging
.
getLogger
(
"examples"
)
filename
=
f
"./outputs/examples
{
separator
}{
output_path
}
.jsonl"
if
output_path
:
formatter
=
logging
.
Formatter
(
"%(message)s"
)
filename
=
f
"./
{
os
.
path
.
dirname
(
output_path
)
}
/examples.jsonl"
handler
=
logging
.
FileHandler
(
filename
)
formatter
=
logging
.
Formatter
(
"%(message)s"
)
handler
.
setFormatter
(
formatter
)
handler
=
logging
.
FileHandler
(
filename
)
example_logger
.
addHandler
(
handler
)
handler
.
setFormatter
(
formatter
)
example_logger
.
addHandler
(
handler
)
example_logger
.
setLevel
(
logging
.
INFO
)
example_logger
.
setLevel
(
logging
.
INFO
)
def
main
():
def
main
():
os
.
makedirs
(
"./outputs"
,
exist_ok
=
True
)
args
=
parse_args
()
args
=
parse_args
()
if
args
.
limit
:
if
args
.
limit
:
...
@@ -80,9 +81,10 @@ def main():
...
@@ -80,9 +81,10 @@ def main():
"REAL METRICS SHOULD NOT BE COMPUTED USING LIMIT."
"REAL METRICS SHOULD NOT BE COMPUTED USING LIMIT."
)
)
path_separator
=
"."
if
args
.
output_path
:
output_path
=
args
.
output_path
if
args
.
output_path
is
not
None
else
""
os
.
makedirs
(
os
.
path
.
dirname
(
args
.
output_path
),
exist_ok
=
True
)
setup_example_logger
(
output_path
,
path_separator
)
setup_example_logger
(
args
.
output_path
)
if
args
.
tasks
is
not
None
:
if
args
.
tasks
is
not
None
:
if
os
.
path
.
isdir
(
args
.
tasks
):
if
os
.
path
.
isdir
(
args
.
tasks
):
...
...
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