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
9a64e642
"examples/community/iadb.py" did not exist on "97e1e3ba76aa9391a63caf742b5f2395771582d4"
Commit
9a64e642
authored
Nov 09, 2023
by
lintangsutawika
Browse files
reformat
parent
75137836
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
14 deletions
+7
-14
lm_eval/api/task.py
lm_eval/api/task.py
+1
-9
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+2
-2
lm_eval/tasks/squad.py
lm_eval/tasks/squad.py
+4
-3
No files found.
lm_eval/api/task.py
View file @
9a64e642
...
...
@@ -204,15 +204,7 @@ class Task(abc.ABC):
self
.
_fewshot_docs
=
None
self
.
_instances
=
None
self
.
_config
=
(
TaskConfig
(
{
**
config
,
}
)
if
config
else
TaskConfig
()
)
self
.
_config
=
TaskConfig
({
**
config
})
if
config
else
TaskConfig
()
self
.
_filters
=
[
build_filter_ensemble
(
"none"
,
[[
"take_first"
,
None
]])]
...
...
lm_eval/tasks/__init__.py
View file @
9a64e642
...
...
@@ -15,11 +15,11 @@ from lm_eval.api.registry import (
import
logging
eval_logger
=
logging
.
getLogger
(
"lm-eval"
)
# import python tasks
from
.squad
import
SQuAD2
from
.scrolls
import
QuALITY
,
NarrativeQA
,
ContractNLI
,
GovReport
,
SummScreenFD
,
QMSum
eval_logger
=
logging
.
getLogger
(
"lm-eval"
)
def
register_configurable_task
(
config
:
Dict
[
str
,
str
])
->
int
:
...
...
lm_eval/tasks/squad.py
View file @
9a64e642
...
...
@@ -34,6 +34,7 @@ _CITATION = """
}
"""
def
_squad_metric
(
predictions
,
references
):
squad_metric
=
datasets
.
load_metric
(
"squad_v2"
)
return
squad_metric
.
compute
(
predictions
=
predictions
,
references
=
references
)
...
...
@@ -125,7 +126,7 @@ class SQuAD2(Task):
arguments
=
(
ctx
,
" "
+
"unanswerable"
),
idx
=
0
,
**
kwargs
)
)
,
]
def
process_results
(
self
,
doc
,
results
):
...
...
@@ -138,7 +139,7 @@ class SQuAD2(Task):
:param results:
The results of the requests created in construct_requests.
"""
continuation
,
(
logprob_unanswerable
,
_
)
=
results
no_answer_probability
=
exp
(
logprob_unanswerable
)
...
...
@@ -234,4 +235,4 @@ class SQuAD2(Task):
"NoAns_f1"
:
True
,
# The F-score of predicted tokens versus the gold answer
"best_exact"
:
True
,
# Best exact match (with varying threshold)
"best_f1"
:
True
,
# Best F1 (with varying threshold)
}
\ No newline at end of file
}
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