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
20c10dfe
Commit
20c10dfe
authored
Dec 28, 2023
by
lintangsutawika
Browse files
kwargs are added to metric_fn through partial at the beginning
parent
e5b245cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
lm_eval/api/task.py
lm_eval/api/task.py
+9
-9
No files found.
lm_eval/api/task.py
View file @
20c10dfe
...
...
@@ -17,6 +17,7 @@ import numpy as np
from
typing
import
Union
,
List
,
Any
,
Tuple
,
Literal
from
collections.abc
import
Callable
from
functools
import
partial
from
lm_eval
import
utils
from
lm_eval.api
import
samplers
...
...
@@ -553,7 +554,6 @@ class ConfigurableTask(Task):
self
.
_metric_fn_list
=
{}
self
.
_metric_fn_kwargs
=
{}
self
.
_aggregation_list
=
{}
self
.
_higher_is_better
=
{}
if
self
.
config
.
metric_list
is
None
:
...
...
@@ -580,19 +580,19 @@ class ConfigurableTask(Task):
and
metric_config
[
"hf_evaluate"
]
is
True
)
if
self
.
config
.
process_results
is
not
None
:
self
.
_metric_fn_list
[
metric_name
]
=
None
self
.
_metric_fn_kwargs
[
metric_name
]
=
{}
el
if
callable
(
metric_name
):
#
if self.config.process_results is not None:
#
self._metric_fn_list[metric_name] = None
#
self._metric_fn_kwargs[metric_name] = {}
if
callable
(
metric_name
):
metric_fn
=
metric_name
.
__call__
metric_name
=
metric_name
.
__name__
self
.
_metric_fn_list
[
metric_name
]
=
metric_fn
self
.
_metric_fn_kwargs
[
metric_name
]
=
kwargs
else
:
self
.
_
metric_fn
_list
[
metric_name
]
=
get_metric
(
metric_fn
=
get_metric
(
metric_name
,
hf_evaluate_metric
)
self
.
_metric_fn_kwargs
[
metric_name
]
=
kwargs
self
.
_metric_fn_kwargs
[
metric_name
]
=
kwargs
self
.
_metric_fn_list
[
metric_name
]
=
partial
(
metric_fn
,
**
kwargs
)
if
kwargs
!=
{}
else
metric_fn
self
.
download
(
self
.
config
.
dataset_kwargs
)
self
.
_training_docs
=
None
...
...
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