Spaces:
Running
Running
kweinmeister
commited on
Commit
•
8777ff1
1
Parent(s):
abfc148
Create evaluation-suite.py
Browse files- evaluation-suite.py +31 -0
evaluation-suite.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import evaluate
|
2 |
+
from evaluate.evaluation_suite import SubTask
|
3 |
+
|
4 |
+
|
5 |
+
class Suite(evaluate.EvaluationSuite):
|
6 |
+
|
7 |
+
def __init__(self, name):
|
8 |
+
super().__init__(name)
|
9 |
+
self.metric = evaluate.load("accuracy")
|
10 |
+
self.preprocessor = lambda x: {"text": x["text"].lower()}
|
11 |
+
self.suite = [
|
12 |
+
{
|
13 |
+
SubTask(
|
14 |
+
task_type="text-classification",
|
15 |
+
data="glue",
|
16 |
+
subset="mnli",
|
17 |
+
split="validation",
|
18 |
+
args_for_task={
|
19 |
+
"metric": self.metric,
|
20 |
+
"input_column": "premise",
|
21 |
+
"second_input_column": "hypothesis",
|
22 |
+
"label_column": "label",
|
23 |
+
"label_mapping": {
|
24 |
+
"ENTAILMENT": 0,
|
25 |
+
"NEUTRAL": 1,
|
26 |
+
"CONTRADICTION": 2,
|
27 |
+
},
|
28 |
+
},
|
29 |
+
)
|
30 |
+
}
|
31 |
+
]
|