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
Commit
9a64e642
authored
Nov 09, 2023
by
lintangsutawika
Browse files
reformat
parent
75137836
Changes
3
Show 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):
...
@@ -204,15 +204,7 @@ class Task(abc.ABC):
self
.
_fewshot_docs
=
None
self
.
_fewshot_docs
=
None
self
.
_instances
=
None
self
.
_instances
=
None
self
.
_config
=
(
self
.
_config
=
TaskConfig
({
**
config
})
if
config
else
TaskConfig
()
TaskConfig
(
{
**
config
,
}
)
if
config
else
TaskConfig
()
)
self
.
_filters
=
[
build_filter_ensemble
(
"none"
,
[[
"take_first"
,
None
]])]
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 (
...
@@ -15,11 +15,11 @@ from lm_eval.api.registry import (
import
logging
import
logging
eval_logger
=
logging
.
getLogger
(
"lm-eval"
)
# import python tasks
# import python tasks
from
.squad
import
SQuAD2
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
:
def
register_configurable_task
(
config
:
Dict
[
str
,
str
])
->
int
:
...
...
lm_eval/tasks/squad.py
View file @
9a64e642
...
@@ -34,6 +34,7 @@ _CITATION = """
...
@@ -34,6 +34,7 @@ _CITATION = """
}
}
"""
"""
def
_squad_metric
(
predictions
,
references
):
def
_squad_metric
(
predictions
,
references
):
squad_metric
=
datasets
.
load_metric
(
"squad_v2"
)
squad_metric
=
datasets
.
load_metric
(
"squad_v2"
)
return
squad_metric
.
compute
(
predictions
=
predictions
,
references
=
references
)
return
squad_metric
.
compute
(
predictions
=
predictions
,
references
=
references
)
...
@@ -125,7 +126,7 @@ class SQuAD2(Task):
...
@@ -125,7 +126,7 @@ class SQuAD2(Task):
arguments
=
(
ctx
,
" "
+
"unanswerable"
),
arguments
=
(
ctx
,
" "
+
"unanswerable"
),
idx
=
0
,
idx
=
0
,
**
kwargs
**
kwargs
)
)
,
]
]
def
process_results
(
self
,
doc
,
results
):
def
process_results
(
self
,
doc
,
results
):
...
...
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