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
35730ace
Commit
35730ace
authored
May 10, 2023
by
lintangsutawika
Browse files
moved METRICS related dicts
parent
d9862c58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
32 deletions
+17
-32
lm_eval/api/__init__.py
lm_eval/api/__init__.py
+1
-32
lm_eval/api/metrics.py
lm_eval/api/metrics.py
+16
-0
No files found.
lm_eval/api/__init__.py
View file @
35730ace
from
.
import
metrics
from
.
import
metrics
\ No newline at end of file
METRIC_REGISTRY
=
{
"matthews_corrcoef"
:
metrics
.
matthews_corrcoef
,
"f1_score"
:
metrics
.
f1_score
,
"perplexity"
:
metrics
.
perplexity
,
"bleu"
:
metrics
.
bleu
,
"chrf"
:
metrics
.
chrf
,
"ter"
:
metrics
.
ter
,
}
AGGREGATION_REGISTRY
=
{
"mean"
:
metrics
.
mean
,
"median"
:
metrics
.
median
,
"perplexity"
:
metrics
.
perplexity
,
}
HIGHER_IS_BETTER_REGISTRY
=
{
"matthews_corrcoef"
:
True
,
"f1_score"
:
True
,
"perplexity"
:
False
,
"bleu"
:
True
,
"chrf"
:
True
,
"ter"
:
False
,
"acc"
:
True
,
"acc_norm"
:
True
,
"acc_mutual_info"
:
True
,
"word_perplexity"
:
False
,
"byte_perplexity"
:
False
,
"bits_per_byte"
:
False
,
}
\ No newline at end of file
lm_eval/api/metrics.py
View file @
35730ace
...
@@ -10,6 +10,7 @@ import evaluate
...
@@ -10,6 +10,7 @@ import evaluate
AGGREGATION_REGISTRY
=
{}
AGGREGATION_REGISTRY
=
{}
METRIC_REGISTRY
=
{
METRIC_REGISTRY
=
{
"acc"
:
None
,
"acc"
:
None
,
"acc_norm"
:
None
,
"acc_norm"
:
None
,
...
@@ -18,6 +19,21 @@ METRIC_REGISTRY = {
...
@@ -18,6 +19,21 @@ METRIC_REGISTRY = {
"byte_perplexity"
:
None
,
"byte_perplexity"
:
None
,
}
}
HIGHER_IS_BETTER_REGISTRY
=
{
"matthews_corrcoef"
:
True
,
"f1_score"
:
True
,
"perplexity"
:
False
,
"bleu"
:
True
,
"chrf"
:
True
,
"ter"
:
False
,
"acc"
:
True
,
"acc_norm"
:
True
,
"acc_mutual_info"
:
True
,
"word_perplexity"
:
False
,
"byte_perplexity"
:
False
,
"bits_per_byte"
:
False
,
}
def
register_metric
(
name
):
def
register_metric
(
name
):
# TODO: do we want to enforce a certain interface to registered metrics?
# TODO: do we want to enforce a certain interface to registered metrics?
...
...
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