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
c5aa5cf0
"vscode:/vscode.git/clone" did not exist on "663dfb65ddd2d0c93e9e4d9f54bb4b67cd9b9dcb"
Commit
c5aa5cf0
authored
Jun 30, 2025
by
Baber
Browse files
nit
parent
1b5c6f88
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
lm_eval/__main__.py
lm_eval/__main__.py
+4
-0
lm_eval/api/task.py
lm_eval/api/task.py
+5
-3
No files found.
lm_eval/__main__.py
View file @
c5aa5cf0
...
@@ -479,6 +479,10 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None:
...
@@ -479,6 +479,10 @@ def cli_evaluate(args: Union[argparse.Namespace, None] = None) -> None:
if
results
is
not
None
:
if
results
is
not
None
:
if
args
.
log_samples
:
if
args
.
log_samples
:
samples
=
results
.
pop
(
"samples"
)
samples
=
results
.
pop
(
"samples"
)
# TODO: fix this!
results
[
"higher_is_better"
]
=
{
k
:
True
for
k
,
v
in
results
[
"higher_is_better"
].
items
()
}
dumped
=
json
.
dumps
(
dumped
=
json
.
dumps
(
results
,
indent
=
2
,
default
=
handle_non_serializable
,
ensure_ascii
=
False
results
,
indent
=
2
,
default
=
handle_non_serializable
,
ensure_ascii
=
False
)
)
...
...
lm_eval/api/task.py
View file @
c5aa5cf0
...
@@ -83,7 +83,7 @@ class MetricConfig:
...
@@ -83,7 +83,7 @@ class MetricConfig:
@
dataclass
@
dataclass
class
FilterConfig
:
class
FilterConfig
:
"""Encapsulates information about a filter."""
"""Encapsulates information about a
single
filter."""
name
:
str
name
:
str
fn
:
Optional
[
Callable
]
=
None
fn
:
Optional
[
Callable
]
=
None
...
@@ -138,6 +138,8 @@ class TaskConfig(dict):
...
@@ -138,6 +138,8 @@ class TaskConfig(dict):
metadata
:
Optional
[
dict
]
=
(
metadata
:
Optional
[
dict
]
=
(
None
# by default, not used in the code. allows for users to pass arbitrary info to tasks
None
# by default, not used in the code. allows for users to pass arbitrary info to tasks
)
)
_metric_list
=
None
_filter_list
=
None
def
__post_init__
(
self
)
->
None
:
def
__post_init__
(
self
)
->
None
:
if
self
.
generation_kwargs
is
not
None
:
if
self
.
generation_kwargs
is
not
None
:
...
@@ -1339,7 +1341,7 @@ class ConfigurableTask(Task):
...
@@ -1339,7 +1341,7 @@ class ConfigurableTask(Task):
return
doc
[
doc_to_text
]
return
doc
[
doc_to_text
]
else
:
else
:
text_string
=
utils
.
apply_template
(
doc_to_text
,
doc
)
text_string
=
utils
.
apply_template
(
doc_to_text
,
doc
)
if
text_string
.
isdigit
()
and
self
.
_
config
.
doc_to_choice
is
not
None
:
if
text_string
.
isdigit
()
and
self
.
config
.
doc_to_choice
is
not
None
:
return
ast
.
literal_eval
(
text_string
)
return
ast
.
literal_eval
(
text_string
)
else
:
else
:
return
text_string
return
text_string
...
@@ -1375,7 +1377,7 @@ class ConfigurableTask(Task):
...
@@ -1375,7 +1377,7 @@ class ConfigurableTask(Task):
return
doc
[
doc_to_target
]
return
doc
[
doc_to_target
]
else
:
else
:
target_string
=
utils
.
apply_template
(
doc_to_target
,
doc
)
target_string
=
utils
.
apply_template
(
doc_to_target
,
doc
)
if
target_string
.
isdigit
()
and
self
.
_
config
.
doc_to_choice
is
not
None
:
if
target_string
.
isdigit
()
and
self
.
config
.
doc_to_choice
is
not
None
:
return
ast
.
literal_eval
(
target_string
)
return
ast
.
literal_eval
(
target_string
)
elif
(
elif
(
len
(
target_string
)
>=
2
len
(
target_string
)
>=
2
...
...
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