Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
fix: fix the bug in loading selected reranker
Browse files
app.py
CHANGED
@@ -82,6 +82,7 @@ def update_metric_long_doc(
|
|
82 |
|
83 |
|
84 |
def update_datastore(version):
|
|
|
85 |
global datastore
|
86 |
global data
|
87 |
datastore = data[version]
|
@@ -89,12 +90,26 @@ def update_datastore(version):
|
|
89 |
selected_langs = get_language_dropdown(QABenchmarks[datastore.slug])
|
90 |
selected_rerankings = get_reranking_dropdown(datastore.reranking_models)
|
91 |
leaderboard_table = get_leaderboard_table(
|
92 |
-
datastore.
|
93 |
-
|
94 |
datastore.raw_df_qa, datastore.types_qa, visible=False)
|
95 |
-
return selected_domains, selected_langs, selected_rerankings, leaderboard_table,
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
demo = gr.Blocks(css=custom_css)
|
100 |
|
@@ -183,7 +198,8 @@ with demo:
|
|
183 |
|
184 |
lb_df_retriever = datastore.leaderboard_df_qa[datastore.leaderboard_df_qa[COL_NAME_RERANKING_MODEL] == "NoReranker"]
|
185 |
lb_df_retriever = reset_rank(lb_df_retriever)
|
186 |
-
lb_table_retriever = get_leaderboard_table(
|
|
|
187 |
|
188 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
189 |
hidden_lb_df_retriever = datastore.raw_df_qa[datastore.raw_df_qa[COL_NAME_RERANKING_MODEL] == "NoReranker"]
|
@@ -193,7 +209,13 @@ with demo:
|
|
193 |
selected_version.change(
|
194 |
update_datastore,
|
195 |
[selected_version,],
|
196 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
)
|
198 |
|
199 |
set_listeners(
|
@@ -233,18 +255,26 @@ with demo:
|
|
233 |
selected_rerankings_reranker = get_reranking_dropdown(reranking_models_reranker)
|
234 |
with gr.Column(scale=1):
|
235 |
search_bar_reranker = gr.Textbox(show_label=False, visible=False)
|
236 |
-
lb_table_reranker = get_leaderboard_table(
|
|
|
237 |
|
238 |
hidden_lb_df_reranker = datastore.raw_df_qa[datastore.raw_df_qa[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK]
|
239 |
hidden_lb_df_reranker = reset_rank(hidden_lb_df_reranker)
|
240 |
hidden_lb_table_reranker = get_leaderboard_table(
|
241 |
-
hidden_lb_df_reranker,
|
|
|
242 |
)
|
243 |
|
244 |
selected_version.change(
|
245 |
update_datastore,
|
246 |
[selected_version,],
|
247 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
)
|
249 |
|
250 |
set_listeners(
|
@@ -300,25 +330,31 @@ with demo:
|
|
300 |
with gr.Column():
|
301 |
selected_rerankings = get_reranking_dropdown(datastore.reranking_models)
|
302 |
|
303 |
-
|
304 |
datastore.leaderboard_df_long_doc, datastore.types_long_doc
|
305 |
)
|
306 |
|
307 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
308 |
-
|
309 |
datastore.raw_df_long_doc, datastore.types_long_doc, visible=False
|
310 |
)
|
311 |
|
312 |
selected_version.change(
|
313 |
-
|
314 |
[selected_version,],
|
315 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
)
|
317 |
|
318 |
set_listeners(
|
319 |
"long-doc",
|
320 |
-
|
321 |
-
|
322 |
search_bar,
|
323 |
selected_version,
|
324 |
selected_domains,
|
@@ -340,7 +376,7 @@ with demo:
|
|
340 |
show_anonymous,
|
341 |
show_revision_and_timestamp
|
342 |
],
|
343 |
-
|
344 |
queue=True
|
345 |
)
|
346 |
"""
|
@@ -350,18 +386,31 @@ with demo:
|
|
350 |
search_bar_retriever = get_search_bar()
|
351 |
with gr.Column(scale=1):
|
352 |
selected_noreranker = get_noreranking_dropdown()
|
353 |
-
lb_df_retriever_long_doc =
|
354 |
-
|
355 |
]
|
356 |
lb_df_retriever_long_doc = reset_rank(lb_df_retriever_long_doc)
|
357 |
-
|
358 |
-
|
|
|
|
|
|
|
359 |
]
|
360 |
hidden_lb_db_retriever_long_doc = reset_rank(hidden_lb_db_retriever_long_doc)
|
361 |
-
lb_table_retriever_long_doc = get_leaderboard_table(
|
362 |
-
lb_df_retriever_long_doc, data["AIR-Bench_24.04"].types_long_doc)
|
363 |
hidden_lb_table_retriever_long_doc = get_leaderboard_table(
|
364 |
-
hidden_lb_db_retriever_long_doc,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
)
|
366 |
|
367 |
set_listeners(
|
@@ -369,6 +418,7 @@ with demo:
|
|
369 |
lb_table_retriever_long_doc,
|
370 |
hidden_lb_table_retriever_long_doc,
|
371 |
search_bar_retriever,
|
|
|
372 |
selected_domains,
|
373 |
selected_langs,
|
374 |
selected_noreranker,
|
@@ -391,8 +441,8 @@ with demo:
|
|
391 |
queue=True
|
392 |
)
|
393 |
with gr.TabItem("Reranking Only", id=22):
|
394 |
-
lb_df_reranker_ldoc =
|
395 |
-
|
396 |
]
|
397 |
lb_df_reranker_ldoc = reset_rank(lb_df_reranker_ldoc)
|
398 |
reranking_models_reranker_ldoc = lb_df_reranker_ldoc[COL_NAME_RERANKING_MODEL].apply(remove_html).unique().tolist()
|
@@ -401,11 +451,11 @@ with demo:
|
|
401 |
selected_rerankings_reranker_ldoc = get_reranking_dropdown(reranking_models_reranker_ldoc)
|
402 |
with gr.Column(scale=1):
|
403 |
search_bar_reranker_ldoc = gr.Textbox(show_label=False, visible=False)
|
404 |
-
lb_table_reranker_ldoc = get_leaderboard_table(lb_df_reranker_ldoc,
|
405 |
-
hidden_lb_df_reranker_ldoc =
|
406 |
hidden_lb_df_reranker_ldoc = reset_rank(hidden_lb_df_reranker_ldoc)
|
407 |
hidden_lb_table_reranker_ldoc = get_leaderboard_table(
|
408 |
-
hidden_lb_df_reranker_ldoc,
|
409 |
)
|
410 |
|
411 |
set_listeners(
|
|
|
82 |
|
83 |
|
84 |
def update_datastore(version):
|
85 |
+
print("triggered update_datastore")
|
86 |
global datastore
|
87 |
global data
|
88 |
datastore = data[version]
|
|
|
90 |
selected_langs = get_language_dropdown(QABenchmarks[datastore.slug])
|
91 |
selected_rerankings = get_reranking_dropdown(datastore.reranking_models)
|
92 |
leaderboard_table = get_leaderboard_table(
|
93 |
+
datastore.leaderboard_df_qa, datastore.types_qa)
|
94 |
+
hidden_leaderboard_table = get_leaderboard_table(
|
95 |
datastore.raw_df_qa, datastore.types_qa, visible=False)
|
96 |
+
return selected_domains, selected_langs, selected_rerankings, leaderboard_table, hidden_leaderboard_table
|
97 |
+
|
98 |
+
|
99 |
+
def update_datastore_long_doc(version):
|
100 |
+
global datastore
|
101 |
+
global data
|
102 |
+
print("triggered update_datastore_long_doc")
|
103 |
+
datastore = data[version]
|
104 |
+
selected_domains = get_domain_dropdown(LongDocBenchmarks[datastore.slug])
|
105 |
+
selected_langs = get_language_dropdown(LongDocBenchmarks[datastore.slug])
|
106 |
+
selected_rerankings = get_reranking_dropdown(datastore.reranking_models)
|
107 |
+
leaderboard_table = get_leaderboard_table(
|
108 |
+
datastore.leaderboard_df_long_doc, datastore.types_long_doc)
|
109 |
+
hidden_leaderboard_table = get_leaderboard_table(
|
110 |
+
datastore.raw_df_long_doc, datastore.types_long_doc, visible=False)
|
111 |
+
return selected_domains, selected_langs, selected_rerankings, leaderboard_table, hidden_leaderboard_table
|
112 |
+
|
113 |
|
114 |
demo = gr.Blocks(css=custom_css)
|
115 |
|
|
|
198 |
|
199 |
lb_df_retriever = datastore.leaderboard_df_qa[datastore.leaderboard_df_qa[COL_NAME_RERANKING_MODEL] == "NoReranker"]
|
200 |
lb_df_retriever = reset_rank(lb_df_retriever)
|
201 |
+
lb_table_retriever = get_leaderboard_table(
|
202 |
+
lb_df_retriever, datastore.types_qa)
|
203 |
|
204 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
205 |
hidden_lb_df_retriever = datastore.raw_df_qa[datastore.raw_df_qa[COL_NAME_RERANKING_MODEL] == "NoReranker"]
|
|
|
209 |
selected_version.change(
|
210 |
update_datastore,
|
211 |
[selected_version,],
|
212 |
+
[
|
213 |
+
selected_domains,
|
214 |
+
selected_langs,
|
215 |
+
selected_noreranker,
|
216 |
+
lb_table_retriever,
|
217 |
+
hidden_lb_table_retriever
|
218 |
+
]
|
219 |
)
|
220 |
|
221 |
set_listeners(
|
|
|
255 |
selected_rerankings_reranker = get_reranking_dropdown(reranking_models_reranker)
|
256 |
with gr.Column(scale=1):
|
257 |
search_bar_reranker = gr.Textbox(show_label=False, visible=False)
|
258 |
+
lb_table_reranker = get_leaderboard_table(
|
259 |
+
lb_df_reranker, datastore.types_qa)
|
260 |
|
261 |
hidden_lb_df_reranker = datastore.raw_df_qa[datastore.raw_df_qa[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK]
|
262 |
hidden_lb_df_reranker = reset_rank(hidden_lb_df_reranker)
|
263 |
hidden_lb_table_reranker = get_leaderboard_table(
|
264 |
+
hidden_lb_df_reranker,
|
265 |
+
datastore.types_qa, visible=False
|
266 |
)
|
267 |
|
268 |
selected_version.change(
|
269 |
update_datastore,
|
270 |
[selected_version,],
|
271 |
+
[
|
272 |
+
selected_domains,
|
273 |
+
selected_langs,
|
274 |
+
selected_rerankings_reranker,
|
275 |
+
lb_table_reranker,
|
276 |
+
hidden_lb_table_reranker
|
277 |
+
]
|
278 |
)
|
279 |
|
280 |
set_listeners(
|
|
|
330 |
with gr.Column():
|
331 |
selected_rerankings = get_reranking_dropdown(datastore.reranking_models)
|
332 |
|
333 |
+
lb_table_long_doc = get_leaderboard_table(
|
334 |
datastore.leaderboard_df_long_doc, datastore.types_long_doc
|
335 |
)
|
336 |
|
337 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
338 |
+
hidden_lb_table_long_doc = get_leaderboard_table(
|
339 |
datastore.raw_df_long_doc, datastore.types_long_doc, visible=False
|
340 |
)
|
341 |
|
342 |
selected_version.change(
|
343 |
+
update_datastore_long_doc,
|
344 |
[selected_version,],
|
345 |
+
[
|
346 |
+
selected_domains,
|
347 |
+
selected_langs,
|
348 |
+
selected_rerankings,
|
349 |
+
lb_table_long_doc,
|
350 |
+
hidden_lb_table_long_doc
|
351 |
+
]
|
352 |
)
|
353 |
|
354 |
set_listeners(
|
355 |
"long-doc",
|
356 |
+
lb_table_long_doc,
|
357 |
+
hidden_lb_table_long_doc,
|
358 |
search_bar,
|
359 |
selected_version,
|
360 |
selected_domains,
|
|
|
376 |
show_anonymous,
|
377 |
show_revision_and_timestamp
|
378 |
],
|
379 |
+
lb_table_long_doc,
|
380 |
queue=True
|
381 |
)
|
382 |
"""
|
|
|
386 |
search_bar_retriever = get_search_bar()
|
387 |
with gr.Column(scale=1):
|
388 |
selected_noreranker = get_noreranking_dropdown()
|
389 |
+
lb_df_retriever_long_doc = datastore.leaderboard_df_long_doc[
|
390 |
+
datastore.leaderboard_df_long_doc[COL_NAME_RERANKING_MODEL] == "NoReranker"
|
391 |
]
|
392 |
lb_df_retriever_long_doc = reset_rank(lb_df_retriever_long_doc)
|
393 |
+
lb_table_retriever_long_doc = get_leaderboard_table(
|
394 |
+
lb_df_retriever_long_doc, datastore.types_long_doc)
|
395 |
+
|
396 |
+
hidden_lb_db_retriever_long_doc = datastore.raw_df_long_doc[
|
397 |
+
datastore.raw_df_long_doc[COL_NAME_RERANKING_MODEL] == "NoReranker"
|
398 |
]
|
399 |
hidden_lb_db_retriever_long_doc = reset_rank(hidden_lb_db_retriever_long_doc)
|
|
|
|
|
400 |
hidden_lb_table_retriever_long_doc = get_leaderboard_table(
|
401 |
+
hidden_lb_db_retriever_long_doc, datastore.types_long_doc, visible=False
|
402 |
+
)
|
403 |
+
|
404 |
+
selected_version.change(
|
405 |
+
update_datastore,
|
406 |
+
[selected_version,],
|
407 |
+
[
|
408 |
+
selected_domains,
|
409 |
+
selected_langs,
|
410 |
+
selected_rerankings,
|
411 |
+
lb_table_retriever_long_doc,
|
412 |
+
hidden_lb_table_retriever_long_doc
|
413 |
+
]
|
414 |
)
|
415 |
|
416 |
set_listeners(
|
|
|
418 |
lb_table_retriever_long_doc,
|
419 |
hidden_lb_table_retriever_long_doc,
|
420 |
search_bar_retriever,
|
421 |
+
selected_version,
|
422 |
selected_domains,
|
423 |
selected_langs,
|
424 |
selected_noreranker,
|
|
|
441 |
queue=True
|
442 |
)
|
443 |
with gr.TabItem("Reranking Only", id=22):
|
444 |
+
lb_df_reranker_ldoc = datastore.leaderboard_df_long_doc[
|
445 |
+
datastore.leaderboard_df_long_doc[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
446 |
]
|
447 |
lb_df_reranker_ldoc = reset_rank(lb_df_reranker_ldoc)
|
448 |
reranking_models_reranker_ldoc = lb_df_reranker_ldoc[COL_NAME_RERANKING_MODEL].apply(remove_html).unique().tolist()
|
|
|
451 |
selected_rerankings_reranker_ldoc = get_reranking_dropdown(reranking_models_reranker_ldoc)
|
452 |
with gr.Column(scale=1):
|
453 |
search_bar_reranker_ldoc = gr.Textbox(show_label=False, visible=False)
|
454 |
+
lb_table_reranker_ldoc = get_leaderboard_table(lb_df_reranker_ldoc, datastore.types_long_doc)
|
455 |
+
hidden_lb_df_reranker_ldoc = datastore.raw_df_long_doc[datastore.raw_df_long_doc[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK]
|
456 |
hidden_lb_df_reranker_ldoc = reset_rank(hidden_lb_df_reranker_ldoc)
|
457 |
hidden_lb_table_reranker_ldoc = get_leaderboard_table(
|
458 |
+
hidden_lb_df_reranker_ldoc, datastore.types_long_doc, visible=False
|
459 |
)
|
460 |
|
461 |
set_listeners(
|