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
515d78b3
Commit
515d78b3
authored
Sep 17, 2020
by
Jason Phang
Browse files
refactor to explicit registries
parent
89de8d7d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
12 deletions
+4
-12
lm_eval/models/__init__.py
lm_eval/models/__init__.py
+4
-4
lm_eval/tasks/coqa.py
lm_eval/tasks/coqa.py
+0
-2
lm_eval/tasks/superglue.py
lm_eval/tasks/superglue.py
+0
-6
No files found.
lm_eval/models/__init__.py
View file @
515d78b3
from
.
gpt2
import
GPT2LM
from
.
gpt3
import
GPT3LM
from
.
import
gpt2
from
.
import
gpt3
MODEL_REGISTRY
=
{
"gpt2"
:
GPT2LM
,
"gpt3"
:
GPT3LM
,
"gpt2"
:
gpt2
.
GPT2LM
,
"gpt3"
:
gpt3
.
GPT3LM
,
}
...
...
lm_eval/tasks/coqa.py
View file @
515d78b3
import
json
import
random
from
lm_eval.base
import
Dataset
from
.
import
TASK_REGISTRY
@
TASK_REGISTRY
.
register
(
"coqa"
)
class
CoQA
(
Dataset
):
def
has_training_docs
(
self
):
return
True
...
...
lm_eval/tasks/superglue.py
View file @
515d78b3
import
numpy
as
np
from
tqdm
import
auto
as
tqdm_lib
from
.
common
import
NLP_TASK
,
simple_accuracy_metric
,
yesno
from
.
import
TASK_REGISTRY
@
TASK_REGISTRY
.
register
(
"boolq"
)
class
BoolQ
(
NLP_TASK
):
NLP_PATH
=
"super_glue"
NLP_NAME
=
"boolq"
...
...
@@ -38,7 +36,6 @@ class BoolQ(NLP_TASK):
return
simple_accuracy_metric
(
preds
=
preds
,
golds
=
golds
)
@
TASK_REGISTRY
.
register
(
"cb"
)
class
CommitmentBank
(
NLP_TASK
):
NLP_PATH
=
"super_glue"
NLP_NAME
=
"cb"
...
...
@@ -82,7 +79,6 @@ class CommitmentBank(NLP_TASK):
return
simple_accuracy_metric
(
preds
=
preds
,
golds
=
golds
)
@
TASK_REGISTRY
.
register
(
"copa"
)
class
Copa
(
NLP_TASK
):
NLP_PATH
=
"super_glue"
NLP_NAME
=
"copa"
...
...
@@ -124,7 +120,6 @@ class Copa(NLP_TASK):
return
choice
[
0
].
lower
()
+
choice
[
1
:]
@
TASK_REGISTRY
.
register
(
"wic"
)
class
WordsInContext
(
NLP_TASK
):
NLP_PATH
=
"super_glue"
NLP_NAME
=
"wic"
...
...
@@ -162,7 +157,6 @@ class WordsInContext(NLP_TASK):
return
simple_accuracy_metric
(
preds
=
preds
,
golds
=
golds
)
@
TASK_REGISTRY
.
register
(
"wsc"
)
class
WinogradSchemaChallenge
(
NLP_TASK
):
NLP_PATH
=
"super_glue"
NLP_NAME
=
"wsc"
...
...
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