Spaces:
No application file
No application file
Commit
•
24a5202
1
Parent(s):
c2819f8
evaluation suite basic framework
Browse files- evaluate-suite-example.py +41 -0
evaluate-suite-example.py
CHANGED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import evaluate
|
2 |
+
from evaluate.evaluation_suite import SubTask
|
3 |
+
|
4 |
+
class Suite(evaluate.EvaluationSuite):
|
5 |
+
|
6 |
+
def __init__(self, name):
|
7 |
+
super().__init__(name)
|
8 |
+
self.preprocessor = lambda x: {"text": x["text"].lower()}
|
9 |
+
self.suite = [
|
10 |
+
SubTask(
|
11 |
+
task_type="text-classification",
|
12 |
+
data="glue",
|
13 |
+
subset="sst2",
|
14 |
+
split="validation[:10]",
|
15 |
+
args_for_task={
|
16 |
+
"metric": "accuracy",
|
17 |
+
"input_column": "sentence",
|
18 |
+
"label_column": "label",
|
19 |
+
"label_mapping": {
|
20 |
+
"LABEL_0": 0.0,
|
21 |
+
"LABEL_1": 1.0
|
22 |
+
}
|
23 |
+
}
|
24 |
+
),
|
25 |
+
SubTask(
|
26 |
+
task_type="text-classification",
|
27 |
+
data="glue",
|
28 |
+
subset="rte",
|
29 |
+
split="validation[:10]",
|
30 |
+
args_for_task={
|
31 |
+
"metric": "accuracy",
|
32 |
+
"input_column": "sentence1",
|
33 |
+
"second_input_column": "sentence2",
|
34 |
+
"label_column": "label",
|
35 |
+
"label_mapping": {
|
36 |
+
"LABEL_0": 0,
|
37 |
+
"LABEL_1": 1
|
38 |
+
}
|
39 |
+
}
|
40 |
+
)
|
41 |
+
]
|