Spaces:
Running
Running
Commit
•
0fa8793
1
Parent(s):
101ad9a
lol
Browse files- glue-suite-v2.py +36 -32
glue-suite-v2.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
-
|
2 |
from typing import Optional, Union, Callable
|
3 |
from dataclasses import dataclass
|
4 |
from datasets import Dataset
|
5 |
|
|
|
|
|
6 |
@dataclass
|
7 |
class SubTask:
|
8 |
model_or_pipeline: Optional[Union[str, "Pipeline", Callable, "PreTrainedModel", "TFPreTrainedModel"]] = None
|
@@ -13,35 +14,38 @@ class SubTask:
|
|
13 |
args_for_task: Optional[dict] = None
|
14 |
|
15 |
|
16 |
-
|
|
|
|
|
|
|
17 |
|
18 |
-
suite = [
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
]
|
|
|
|
|
1 |
from typing import Optional, Union, Callable
|
2 |
from dataclasses import dataclass
|
3 |
from datasets import Dataset
|
4 |
|
5 |
+
from evaluate.evaluation_suite import EvaluationSuite
|
6 |
+
|
7 |
@dataclass
|
8 |
class SubTask:
|
9 |
model_or_pipeline: Optional[Union[str, "Pipeline", Callable, "PreTrainedModel", "TFPreTrainedModel"]] = None
|
|
|
14 |
args_for_task: Optional[dict] = None
|
15 |
|
16 |
|
17 |
+
class EvaluationSuite:
|
18 |
+
|
19 |
+
def __init__(self):
|
20 |
+
self.preprocessor = None #lambda x: x["text"].lower()
|
21 |
|
22 |
+
self.suite = [
|
23 |
+
SubTask(
|
24 |
+
data="imdb",
|
25 |
+
split="test",
|
26 |
+
data_preprocessor=self.preprocessor,
|
27 |
+
args_for_task={
|
28 |
+
"metric": "accuracy",
|
29 |
+
"input_column": "text",
|
30 |
+
"label_column": "label",
|
31 |
+
"label_mapping": {
|
32 |
+
"LABEL_0": 0.0,
|
33 |
+
"LABEL_1": 1.0
|
34 |
+
}
|
35 |
+
}
|
36 |
+
),
|
37 |
+
SubTask(
|
38 |
+
data="sst2",
|
39 |
+
split="test[:10]",
|
40 |
+
data_preprocessor=self.preprocessor,
|
41 |
+
args_for_task={
|
42 |
+
"metric": "accuracy",
|
43 |
+
"input_column": "sentence",
|
44 |
+
"label_column": "label",
|
45 |
+
"label_mapping": {
|
46 |
+
"LABEL_0": 0.0,
|
47 |
+
"LABEL_1": 1.0
|
48 |
+
}
|
49 |
+
}
|
50 |
+
)
|
51 |
+
]
|