1. Removed redundant code
Browse files2. Optimized imports
3. Removed unnecessary comments
app.py
CHANGED
@@ -329,7 +329,6 @@ with demo:
|
|
329 |
getattr(comp, fn)(
|
330 |
core.update_df,
|
331 |
[gr.State(value=0), shown_tasks, search_bar, langs_bar, model_sizes, gr.State(value=True), model_types],
|
332 |
-
# [shown_tasks, search_bar, langs_bar, model_types, gr.State(value=True)],
|
333 |
leaderboard_table,
|
334 |
)
|
335 |
|
|
|
329 |
getattr(comp, fn)(
|
330 |
core.update_df,
|
331 |
[gr.State(value=0), shown_tasks, search_bar, langs_bar, model_sizes, gr.State(value=True), model_types],
|
|
|
332 |
leaderboard_table,
|
333 |
)
|
334 |
|
core.py
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
import itertools
|
2 |
import os
|
3 |
|
4 |
-
import gradio as gr
|
5 |
import numpy as np
|
6 |
import pandas as pd
|
7 |
from datasets import load_dataset
|
8 |
|
9 |
import style
|
10 |
-
from style import T_SYMBOLS
|
11 |
from utils import add_model_hyperlink
|
12 |
|
13 |
ZERO_SHOT_ONLY = ["BELEBELE", "MT-Bench"]
|
@@ -154,72 +153,6 @@ def update_df(
|
|
154 |
return sort_cols(df, fewshot)
|
155 |
|
156 |
|
157 |
-
def update_fewshot_status(current_selected_tab, is_fewshot_current):
|
158 |
-
if current_selected_tab == 0:
|
159 |
-
is_fewshot_new = is_fewshot_current
|
160 |
-
fewshot_available = True
|
161 |
-
elif current_selected_tab == 1:
|
162 |
-
is_fewshot_new = False
|
163 |
-
fewshot_available = False
|
164 |
-
elif current_selected_tab == 2:
|
165 |
-
is_fewshot_new = False
|
166 |
-
fewshot_available = False
|
167 |
-
else:
|
168 |
-
raise ValueError(f"Unknown tab id {current_selected_tab}")
|
169 |
-
|
170 |
-
return is_fewshot_new, fewshot_available
|
171 |
-
|
172 |
-
|
173 |
-
def update_task_groups_and_fewshot(current_selected_tab: int, model_types, langs_bar,
|
174 |
-
is_fewshot_current: bool = False, ):
|
175 |
-
selected_task_type = get_selected_task_type(current_selected_tab)
|
176 |
-
available_tasks = get_available_task_groups(selected_task_type, is_fewshot_current)
|
177 |
-
new_selected_tasks = available_tasks.copy()
|
178 |
-
|
179 |
-
tasks_checkbox_group_update = gr.CheckboxGroup(
|
180 |
-
choices=available_tasks,
|
181 |
-
value=new_selected_tasks,
|
182 |
-
)
|
183 |
-
|
184 |
-
is_fewshot_new, fewshot_available = update_fewshot_status(current_selected_tab, is_fewshot_current)
|
185 |
-
|
186 |
-
# fewshot_radio_update = gr.Radio(
|
187 |
-
# value=is_fewshot_new,
|
188 |
-
# interactive=fewshot_available,
|
189 |
-
# )
|
190 |
-
|
191 |
-
if current_selected_tab == 2:
|
192 |
-
model_types = gr.CheckboxGroup(
|
193 |
-
value=[T_SYMBOLS['chat']],
|
194 |
-
interactive=False
|
195 |
-
)
|
196 |
-
langs_bar = gr.CheckboxGroup(
|
197 |
-
choices=[(MT_BENCH_LANG_SYMBOLS.get(l, l), l) for l in mt_bench_language_list],
|
198 |
-
value=mt_bench_language_list,
|
199 |
-
interactive=True,
|
200 |
-
)
|
201 |
-
else:
|
202 |
-
model_types = gr.CheckboxGroup(
|
203 |
-
label="Select model type",
|
204 |
-
choices=[
|
205 |
-
(
|
206 |
-
f"Pretrained {T_SYMBOLS['pretrained']}",
|
207 |
-
T_SYMBOLS["pretrained"],
|
208 |
-
),
|
209 |
-
(f"Chat {T_SYMBOLS['chat']}", T_SYMBOLS["chat"]),
|
210 |
-
],
|
211 |
-
value=list(T_SYMBOLS.values()),
|
212 |
-
interactive=True
|
213 |
-
)
|
214 |
-
langs_bar = gr.CheckboxGroup(
|
215 |
-
choices=[(LANG_SYMBOLS.get(l, l), l) for l in languages_list],
|
216 |
-
value=languages_list,
|
217 |
-
interactive=True,
|
218 |
-
)
|
219 |
-
|
220 |
-
return [tasks_checkbox_group_update, current_selected_tab, model_types, langs_bar]
|
221 |
-
|
222 |
-
|
223 |
def get_selected_task_type(task_type_id):
|
224 |
task_types = {0: "accuracy", 1: "misc", 2: "mtbench_score", 3: "accuracy"}
|
225 |
selected_task_type = task_types[task_type_id]
|
|
|
1 |
import itertools
|
2 |
import os
|
3 |
|
|
|
4 |
import numpy as np
|
5 |
import pandas as pd
|
6 |
from datasets import load_dataset
|
7 |
|
8 |
import style
|
9 |
+
from style import T_SYMBOLS
|
10 |
from utils import add_model_hyperlink
|
11 |
|
12 |
ZERO_SHOT_ONLY = ["BELEBELE", "MT-Bench"]
|
|
|
153 |
return sort_cols(df, fewshot)
|
154 |
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
def get_selected_task_type(task_type_id):
|
157 |
task_types = {0: "accuracy", 1: "misc", 2: "mtbench_score", 3: "accuracy"}
|
158 |
selected_task_type = task_types[task_type_id]
|