jjbuschhoff
commited on
Commit
•
65504f2
1
Parent(s):
57ec188
Temporary mechanism for filtering tasks from zero- or few-shot view
Browse files
core.py
CHANGED
@@ -10,8 +10,8 @@ from datasets import load_dataset
|
|
10 |
import style
|
11 |
|
12 |
TAB_STATE = 0 # FIXME
|
13 |
-
|
14 |
-
|
15 |
|
16 |
|
17 |
def init():
|
@@ -45,10 +45,6 @@ def init():
|
|
45 |
|
46 |
def sort_cols(df: pd.DataFrame, fewshot: bool = False) -> pd.DataFrame:
|
47 |
task_cols = get_task_columns(df)
|
48 |
-
if fewshot:
|
49 |
-
renamer = {col: f"{col} ({task_groups_shots_dict[col]}-shot)" for col in task_cols if col in task_groups_shots_dict}
|
50 |
-
df.rename(columns=renamer, inplace=True)
|
51 |
-
task_cols = renamer.values()
|
52 |
return df.reindex(["Type", "Model_Name", "Average"] + sorted(task_cols), axis=1)
|
53 |
|
54 |
|
@@ -125,7 +121,7 @@ def update_df(
|
|
125 |
df = filter_type(df, model_types)
|
126 |
|
127 |
if format:
|
128 |
-
return sort_cols(df, fewshot).style.format(precision=2, decimal=".")
|
129 |
else:
|
130 |
return sort_cols(df, fewshot)
|
131 |
|
@@ -159,25 +155,14 @@ def fix_zeroshot(tasks: list[str | int | float], fewshot: bool = False):
|
|
159 |
selected_task_type = get_selected_task_type(TAB_STATE)
|
160 |
choices = task_groups_with_task_type(selected_task_type)
|
161 |
if not fewshot:
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
pass
|
166 |
-
if TAB_STATE == 0:
|
167 |
-
value = [v for v in tasks if v in choices]
|
168 |
-
if BELEBELE_TASK_GROUP_NAME not in value:
|
169 |
-
value += [BELEBELE_TASK_GROUP_NAME]
|
170 |
-
elif TAB_STATE == 1:
|
171 |
-
value = [v for v in tasks if v in choices]
|
172 |
else:
|
173 |
-
try:
|
174 |
-
choices.remove(BELEBELE_TASK_GROUP_NAME)
|
175 |
-
except ValueError:
|
176 |
-
pass
|
177 |
if TAB_STATE == 0:
|
|
|
178 |
value = [v for v in tasks if v in choices]
|
179 |
-
if
|
180 |
-
value += [GSM8K_TASK_GROUP_NAME]
|
181 |
elif TAB_STATE == 1:
|
182 |
value = [v for v in tasks if v in choices]
|
183 |
shown_tasks = gr.CheckboxGroup(
|
@@ -198,16 +183,7 @@ def update_tab_tasks(id: int, fewshot: bool = False):
|
|
198 |
selected_task_type = get_selected_task_type(TAB_STATE)
|
199 |
choices = task_groups_with_task_type(selected_task_type)
|
200 |
if not fewshot:
|
201 |
-
|
202 |
-
choices.remove(GSM8K_TASK_GROUP_NAME)
|
203 |
-
except ValueError:
|
204 |
-
pass
|
205 |
-
else:
|
206 |
-
try:
|
207 |
-
choices.remove(BELEBELE_TASK_GROUP_NAME)
|
208 |
-
except ValueError:
|
209 |
-
pass
|
210 |
-
|
211 |
values = choices.copy()
|
212 |
shown_tasks = gr.CheckboxGroup(
|
213 |
choices=choices,
|
|
|
10 |
import style
|
11 |
|
12 |
TAB_STATE = 0 # FIXME
|
13 |
+
NO_FEWSHOT = ["BELEBELE"] # FIXME
|
14 |
+
NO_ZEROSHOT = ["GSM8K"] # FIXME
|
15 |
|
16 |
|
17 |
def init():
|
|
|
45 |
|
46 |
def sort_cols(df: pd.DataFrame, fewshot: bool = False) -> pd.DataFrame:
|
47 |
task_cols = get_task_columns(df)
|
|
|
|
|
|
|
|
|
48 |
return df.reindex(["Type", "Model_Name", "Average"] + sorted(task_cols), axis=1)
|
49 |
|
50 |
|
|
|
121 |
df = filter_type(df, model_types)
|
122 |
|
123 |
if format:
|
124 |
+
return sort_cols(df, fewshot).style.format(precision=2, decimal=".", na_rep="N/A")
|
125 |
else:
|
126 |
return sort_cols(df, fewshot)
|
127 |
|
|
|
155 |
selected_task_type = get_selected_task_type(TAB_STATE)
|
156 |
choices = task_groups_with_task_type(selected_task_type)
|
157 |
if not fewshot:
|
158 |
+
choices = [c for c in choices if c not in NO_ZEROSHOT]
|
159 |
+
value = [v for v in tasks if v in choices]
|
160 |
+
value += [t for t in NO_FEWSHOT if t not in value]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
else:
|
|
|
|
|
|
|
|
|
162 |
if TAB_STATE == 0:
|
163 |
+
choices = [c for c in choices if c not in NO_FEWSHOT]
|
164 |
value = [v for v in tasks if v in choices]
|
165 |
+
value += [t for t in NO_ZEROSHOT if t not in value]
|
|
|
166 |
elif TAB_STATE == 1:
|
167 |
value = [v for v in tasks if v in choices]
|
168 |
shown_tasks = gr.CheckboxGroup(
|
|
|
183 |
selected_task_type = get_selected_task_type(TAB_STATE)
|
184 |
choices = task_groups_with_task_type(selected_task_type)
|
185 |
if not fewshot:
|
186 |
+
choices = [c for c in choices if c not in NO_ZEROSHOT]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
values = choices.copy()
|
188 |
shown_tasks = gr.CheckboxGroup(
|
189 |
choices=choices,
|