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
304bd6eb
Unverified
Commit
304bd6eb
authored
Jul 05, 2023
by
Lintang Sutawika
Committed by
GitHub
Jul 05, 2023
Browse files
Update metric loading
parent
4f0a7e57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
lm_eval/api/task.py
lm_eval/api/task.py
+24
-1
No files found.
lm_eval/api/task.py
View file @
304bd6eb
...
...
@@ -530,9 +530,32 @@ class ConfigurableTask(Task):
for
key
in
metric_config
if
key
not
in
[
"metric"
,
"aggregation"
,
"higher_is_better"
]
}
self
.
_metric_fn_list
[
metric_name
]
=
get_metric
(
metric_name
)
self
.
_metric_fn_kwargs
[
metric_name
]
=
kwargs
if
"fn"
in
metric_config
:
self
.
_metric_fn_list
[
metric_name
]
=
metric_config
[
"fn"
]
else
:
try
:
self
.
_metric_fn_list
[
metric_name
]
=
METRIC_REGISTRY
[
metric_name
]
except
Exception
:
eval_logger
.
warning
(
f
"Metric
{
metric_name
}
not found, "
"Searching from https://huggingface.co/evaluate-metric"
)
try
:
metric_object
=
evaluate
.
load
(
metric_name
)
self
.
_metric_fn_list
[
metric_name
]
=
metric_object
self
.
_metric_fn_kwargs
[
metric_name
]
=
kwargs
except
Exception
:
raise
Warning
(
"{} not found in the evaluate library!"
.
format
(
metric_name
),
"Please check https://huggingface.co/evaluate-metric"
,
)
if
"aggregation"
in
metric_config
:
agg_name
=
metric_config
[
"aggregation"
]
if
type
(
agg_name
)
==
str
:
...
...
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