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
9e29c2a8
Commit
9e29c2a8
authored
Oct 04, 2020
by
Leo Gao
Browse files
Implement ARC
parent
edbb1a49
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
lm_eval/tasks/__init__.py
lm_eval/tasks/__init__.py
+3
-0
lm_eval/tasks/arc.py
lm_eval/tasks/arc.py
+32
-0
No files found.
lm_eval/tasks/__init__.py
View file @
9e29c2a8
from
.
import
superglue
from
.
import
superglue
from
.
import
glue
from
.
import
glue
from
.
import
arc
TASK_REGISTRY
=
{
TASK_REGISTRY
=
{
"cola"
:
glue
.
CoLA
,
"cola"
:
glue
.
CoLA
,
...
@@ -16,6 +17,8 @@ TASK_REGISTRY = {
...
@@ -16,6 +17,8 @@ TASK_REGISTRY = {
"copa"
:
superglue
.
Copa
,
"copa"
:
superglue
.
Copa
,
"wic"
:
superglue
.
WordsInContext
,
"wic"
:
superglue
.
WordsInContext
,
"wsc"
:
superglue
.
WinogradSchemaChallenge
,
"wsc"
:
superglue
.
WinogradSchemaChallenge
,
"arc_easy"
:
arc
.
ARCEasy
,
"arc_challenge"
:
arc
.
ARCChallenge
,
}
}
...
...
lm_eval/tasks/arc.py
0 → 100644
View file @
9e29c2a8
from
.
common
import
HFNLPTask
class
ARCEasy
(
HFNLPTask
):
NLP_PATH
=
"ai2_arc"
NLP_NAME
=
"ARC-Easy"
def
has_training_docs
(
self
):
return
True
def
has_validation_docs
(
self
):
return
True
def
has_test_docs
(
self
):
return
True
def
fewshot_description
(
self
):
# TODO: figure out description
return
""
def
doc_to_text
(
self
,
doc
,
include_target
=
True
):
print
(
doc
)
q
=
"Question: "
+
doc
[
'question'
]
+
'
\n
'
a
=
"Answer:"
+
(
" "
+
doc
[
'choices'
][
'text'
][
doc
[
'choices'
][
'label'
].
index
(
doc
[
'answerKey'
])])
if
include_target
else
""
return
q
+
a
def
evaluate
(
self
,
docs
,
lm
,
provide_description
,
num_fewshot
):
# TODO: implement
raise
NotImplementedError
()
class
ARCChallenge
(
ARCEasy
):
NLP_PATH
=
"ai2_arc"
NLP_NAME
=
"ARC-Challenge"
\ 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