Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
refactor: refactor the naming
Browse files
app.py
CHANGED
@@ -170,20 +170,20 @@ with demo:
|
|
170 |
with gr.Column():
|
171 |
models = get_reranking_dropdown(datastore.reranking_models)
|
172 |
# shown_table
|
173 |
-
|
174 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
175 |
-
|
176 |
|
177 |
version.change(
|
178 |
update_qa_version,
|
179 |
version,
|
180 |
-
[domains, langs, models,
|
181 |
)
|
182 |
|
183 |
set_listeners(
|
184 |
"qa",
|
185 |
-
|
186 |
-
|
187 |
search_bar,
|
188 |
version,
|
189 |
domains,
|
@@ -197,136 +197,114 @@ with demo:
|
|
197 |
metric.change(
|
198 |
update_qa_metric,
|
199 |
[metric, domains, langs, models, search_bar, show_anonymous, show_rev_ts],
|
200 |
-
|
201 |
queue=True,
|
202 |
)
|
203 |
|
204 |
with gr.TabItem("Retrieval Only", id=11):
|
205 |
with gr.Row():
|
206 |
with gr.Column(scale=1):
|
207 |
-
|
208 |
with gr.Column(scale=1):
|
209 |
-
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
lb_df_retriever = reset_rank(lb_df_retriever)
|
215 |
-
lb_table_retriever = get_leaderboard_table(lb_df_retriever, datastore.qa_types)
|
216 |
|
217 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
hidden_lb_df_retriever = reset_rank(hidden_lb_df_retriever)
|
222 |
-
hidden_lb_table_retriever = get_leaderboard_table(
|
223 |
-
hidden_lb_df_retriever, datastore.qa_types, visible=False
|
224 |
-
)
|
225 |
|
226 |
version.change(
|
227 |
update_qa_version,
|
228 |
-
|
229 |
-
|
230 |
-
],
|
231 |
-
[
|
232 |
-
domains,
|
233 |
-
langs,
|
234 |
-
selected_noreranker,
|
235 |
-
lb_table_retriever,
|
236 |
-
hidden_lb_table_retriever,
|
237 |
-
],
|
238 |
)
|
239 |
|
240 |
set_listeners(
|
241 |
"qa",
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
version,
|
246 |
domains,
|
247 |
langs,
|
248 |
-
|
249 |
show_anonymous,
|
250 |
show_rev_ts,
|
251 |
)
|
252 |
|
253 |
-
# set metric listener
|
254 |
metric.change(
|
255 |
update_qa_metric,
|
256 |
[
|
257 |
metric,
|
258 |
domains,
|
259 |
langs,
|
260 |
-
|
261 |
-
|
262 |
show_anonymous,
|
263 |
show_rev_ts,
|
264 |
],
|
265 |
-
|
266 |
queue=True,
|
267 |
)
|
|
|
268 |
with gr.TabItem("Reranking Only", id=12):
|
269 |
-
|
270 |
datastore.qa_fmt_df[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
271 |
]
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
)
|
276 |
with gr.Row():
|
277 |
with gr.Column(scale=1):
|
278 |
-
|
279 |
with gr.Column(scale=1):
|
280 |
-
|
281 |
-
|
282 |
|
283 |
-
|
284 |
datastore.qa_raw_df[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
285 |
]
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
)
|
290 |
|
291 |
version.change(
|
292 |
update_qa_version,
|
293 |
-
|
294 |
-
|
295 |
-
],
|
296 |
-
[
|
297 |
-
domains,
|
298 |
-
langs,
|
299 |
-
selected_rerankings_reranker,
|
300 |
-
lb_table_reranker,
|
301 |
-
hidden_lb_table_reranker,
|
302 |
-
],
|
303 |
)
|
304 |
|
305 |
set_listeners(
|
306 |
"qa",
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
version,
|
311 |
domains,
|
312 |
langs,
|
313 |
-
|
314 |
show_anonymous,
|
315 |
show_rev_ts,
|
316 |
)
|
317 |
-
|
318 |
metric.change(
|
319 |
update_qa_metric,
|
320 |
[
|
321 |
metric,
|
322 |
domains,
|
323 |
langs,
|
324 |
-
|
325 |
-
|
326 |
show_anonymous,
|
327 |
show_rev_ts,
|
328 |
],
|
329 |
-
|
330 |
queue=True,
|
331 |
)
|
332 |
with gr.TabItem("Long Doc", elem_id="long-doc-benchmark-tab-table", id=1):
|
@@ -354,33 +332,25 @@ with demo:
|
|
354 |
with gr.Column():
|
355 |
models = get_reranking_dropdown(datastore.reranking_models)
|
356 |
|
357 |
-
|
358 |
datastore.doc_fmt_df, datastore.doc_types
|
359 |
)
|
360 |
|
361 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
362 |
-
|
363 |
datastore.doc_raw_df, datastore.doc_types, visible=False
|
364 |
)
|
365 |
|
366 |
version.change(
|
367 |
update_doc_version,
|
368 |
-
|
369 |
-
|
370 |
-
],
|
371 |
-
[
|
372 |
-
domains,
|
373 |
-
langs,
|
374 |
-
models,
|
375 |
-
lb_table_long_doc,
|
376 |
-
hidden_lb_table_long_doc,
|
377 |
-
],
|
378 |
)
|
379 |
|
380 |
set_listeners(
|
381 |
"long-doc",
|
382 |
-
|
383 |
-
|
384 |
search_bar,
|
385 |
version,
|
386 |
domains,
|
@@ -402,54 +372,47 @@ with demo:
|
|
402 |
show_anonymous,
|
403 |
show_rev_ts,
|
404 |
],
|
405 |
-
|
406 |
queue=True,
|
407 |
)
|
408 |
with gr.TabItem("Retrieval Only", id=21):
|
409 |
with gr.Row():
|
410 |
with gr.Column(scale=1):
|
411 |
-
|
412 |
with gr.Column(scale=1):
|
413 |
-
|
414 |
-
|
|
|
415 |
datastore.doc_fmt_df[COL_NAME_RERANKING_MODEL] == "NoReranker"
|
416 |
]
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
)
|
421 |
|
422 |
-
|
423 |
datastore.doc_raw_df[COL_NAME_RERANKING_MODEL] == "NoReranker"
|
424 |
]
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
)
|
429 |
|
430 |
version.change(
|
431 |
update_doc_version,
|
432 |
-
|
433 |
-
|
434 |
-
],
|
435 |
-
[
|
436 |
-
domains,
|
437 |
-
langs,
|
438 |
-
selected_noreranker,
|
439 |
-
lb_table_retriever_long_doc,
|
440 |
-
hidden_lb_table_retriever_long_doc,
|
441 |
-
],
|
442 |
)
|
443 |
|
444 |
set_listeners(
|
445 |
"long-doc",
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
version,
|
450 |
domains,
|
451 |
langs,
|
452 |
-
|
453 |
show_anonymous,
|
454 |
show_rev_ts,
|
455 |
)
|
@@ -460,76 +423,69 @@ with demo:
|
|
460 |
metric,
|
461 |
domains,
|
462 |
langs,
|
463 |
-
|
464 |
-
|
465 |
show_anonymous,
|
466 |
show_rev_ts,
|
467 |
],
|
468 |
-
|
469 |
queue=True,
|
470 |
)
|
471 |
with gr.TabItem("Reranking Only", id=22):
|
472 |
-
|
473 |
datastore.doc_fmt_df[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
474 |
]
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
)
|
479 |
with gr.Row():
|
480 |
with gr.Column(scale=1):
|
481 |
-
|
482 |
-
|
483 |
)
|
484 |
with gr.Column(scale=1):
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
datastore.doc_raw_df[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
489 |
]
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
)
|
494 |
|
495 |
version.change(
|
496 |
update_doc_version,
|
497 |
-
|
498 |
-
|
499 |
-
],
|
500 |
-
[
|
501 |
-
domains,
|
502 |
-
langs,
|
503 |
-
selected_rerankings_reranker_ldoc,
|
504 |
-
lb_table_reranker_ldoc,
|
505 |
-
hidden_lb_table_reranker_ldoc,
|
506 |
-
],
|
507 |
)
|
508 |
|
509 |
set_listeners(
|
510 |
"long-doc",
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
version,
|
515 |
domains,
|
516 |
langs,
|
517 |
-
|
518 |
show_anonymous,
|
519 |
show_rev_ts,
|
520 |
)
|
|
|
521 |
metric.change(
|
522 |
update_doc_metric,
|
523 |
[
|
524 |
metric,
|
525 |
domains,
|
526 |
langs,
|
527 |
-
|
528 |
-
|
529 |
show_anonymous,
|
530 |
show_rev_ts,
|
531 |
],
|
532 |
-
|
533 |
queue=True,
|
534 |
)
|
535 |
|
|
|
170 |
with gr.Column():
|
171 |
models = get_reranking_dropdown(datastore.reranking_models)
|
172 |
# shown_table
|
173 |
+
qa_df_elem_ret_rerank = get_leaderboard_table(datastore.qa_fmt_df, datastore.qa_types)
|
174 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
175 |
+
qa_df_elem_ret_rerank_hidden = get_leaderboard_table(datastore.qa_raw_df, datastore.qa_types, visible=False)
|
176 |
|
177 |
version.change(
|
178 |
update_qa_version,
|
179 |
version,
|
180 |
+
[domains, langs, models, qa_df_elem_ret_rerank, qa_df_elem_ret_rerank_hidden],
|
181 |
)
|
182 |
|
183 |
set_listeners(
|
184 |
"qa",
|
185 |
+
qa_df_elem_ret_rerank,
|
186 |
+
qa_df_elem_ret_rerank_hidden,
|
187 |
search_bar,
|
188 |
version,
|
189 |
domains,
|
|
|
197 |
metric.change(
|
198 |
update_qa_metric,
|
199 |
[metric, domains, langs, models, search_bar, show_anonymous, show_rev_ts],
|
200 |
+
qa_df_elem_ret_rerank,
|
201 |
queue=True,
|
202 |
)
|
203 |
|
204 |
with gr.TabItem("Retrieval Only", id=11):
|
205 |
with gr.Row():
|
206 |
with gr.Column(scale=1):
|
207 |
+
search_bar_ret = get_search_bar()
|
208 |
with gr.Column(scale=1):
|
209 |
+
models_ret = get_noreranking_dropdown()
|
210 |
|
211 |
+
_qa_df_ret = datastore.qa_fmt_df[datastore.qa_fmt_df[COL_NAME_RERANKING_MODEL] == "NoReranker"]
|
212 |
+
_qa_df_ret = reset_rank(_qa_df_ret)
|
213 |
+
qa_df_elem_ret = get_leaderboard_table(_qa_df_ret, datastore.qa_types)
|
|
|
|
|
214 |
|
215 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
216 |
+
_qa_df_ret_hidden = datastore.qa_raw_df[datastore.qa_raw_df[COL_NAME_RERANKING_MODEL] == "NoReranker"]
|
217 |
+
_qa_df_ret_hidden = reset_rank(_qa_df_ret_hidden)
|
218 |
+
qa_df_elem_ret_hidden = get_leaderboard_table(_qa_df_ret_hidden, datastore.qa_types, visible=False)
|
|
|
|
|
|
|
|
|
219 |
|
220 |
version.change(
|
221 |
update_qa_version,
|
222 |
+
version,
|
223 |
+
[domains, langs, models_ret, qa_df_elem_ret, qa_df_elem_ret_hidden, ],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
)
|
225 |
|
226 |
set_listeners(
|
227 |
"qa",
|
228 |
+
qa_df_elem_ret,
|
229 |
+
qa_df_elem_ret_hidden,
|
230 |
+
search_bar_ret,
|
231 |
version,
|
232 |
domains,
|
233 |
langs,
|
234 |
+
models_ret,
|
235 |
show_anonymous,
|
236 |
show_rev_ts,
|
237 |
)
|
238 |
|
|
|
239 |
metric.change(
|
240 |
update_qa_metric,
|
241 |
[
|
242 |
metric,
|
243 |
domains,
|
244 |
langs,
|
245 |
+
models_ret,
|
246 |
+
search_bar_ret,
|
247 |
show_anonymous,
|
248 |
show_rev_ts,
|
249 |
],
|
250 |
+
qa_df_elem_ret,
|
251 |
queue=True,
|
252 |
)
|
253 |
+
|
254 |
with gr.TabItem("Reranking Only", id=12):
|
255 |
+
_qa_df_rerank = datastore.qa_fmt_df[
|
256 |
datastore.qa_fmt_df[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
257 |
]
|
258 |
+
_qa_df_rerank = reset_rank(_qa_df_rerank)
|
259 |
+
qa_rerank_models = (
|
260 |
+
_qa_df_rerank[COL_NAME_RERANKING_MODEL].apply(remove_html).unique().tolist()
|
261 |
)
|
262 |
with gr.Row():
|
263 |
with gr.Column(scale=1):
|
264 |
+
qa_models_rerank = get_reranking_dropdown(qa_rerank_models)
|
265 |
with gr.Column(scale=1):
|
266 |
+
qa_search_bar_rerank = gr.Textbox(show_label=False, visible=False)
|
267 |
+
qa_df_elem_rerank = get_leaderboard_table(_qa_df_rerank, datastore.qa_types)
|
268 |
|
269 |
+
_qa_df_rerank_hidden = datastore.qa_raw_df[
|
270 |
datastore.qa_raw_df[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
271 |
]
|
272 |
+
_qa_df_rerank_hidden = reset_rank(_qa_df_rerank_hidden)
|
273 |
+
qa_df_elem_rerank_hidden = get_leaderboard_table(
|
274 |
+
_qa_df_rerank_hidden, datastore.qa_types, visible=False
|
275 |
)
|
276 |
|
277 |
version.change(
|
278 |
update_qa_version,
|
279 |
+
version,
|
280 |
+
[domains, langs, qa_models_rerank, qa_df_elem_rerank, qa_df_elem_rerank_hidden],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
)
|
282 |
|
283 |
set_listeners(
|
284 |
"qa",
|
285 |
+
qa_df_elem_rerank,
|
286 |
+
qa_df_elem_rerank_hidden,
|
287 |
+
qa_search_bar_rerank,
|
288 |
version,
|
289 |
domains,
|
290 |
langs,
|
291 |
+
qa_models_rerank,
|
292 |
show_anonymous,
|
293 |
show_rev_ts,
|
294 |
)
|
295 |
+
|
296 |
metric.change(
|
297 |
update_qa_metric,
|
298 |
[
|
299 |
metric,
|
300 |
domains,
|
301 |
langs,
|
302 |
+
qa_models_rerank,
|
303 |
+
qa_search_bar_rerank,
|
304 |
show_anonymous,
|
305 |
show_rev_ts,
|
306 |
],
|
307 |
+
qa_df_elem_rerank,
|
308 |
queue=True,
|
309 |
)
|
310 |
with gr.TabItem("Long Doc", elem_id="long-doc-benchmark-tab-table", id=1):
|
|
|
332 |
with gr.Column():
|
333 |
models = get_reranking_dropdown(datastore.reranking_models)
|
334 |
|
335 |
+
doc_df_elem_ret_rerank = get_leaderboard_table(
|
336 |
datastore.doc_fmt_df, datastore.doc_types
|
337 |
)
|
338 |
|
339 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
340 |
+
doc_df_elem_ret_rerank_hidden = get_leaderboard_table(
|
341 |
datastore.doc_raw_df, datastore.doc_types, visible=False
|
342 |
)
|
343 |
|
344 |
version.change(
|
345 |
update_doc_version,
|
346 |
+
version,
|
347 |
+
[domains, langs, models, doc_df_elem_ret_rerank, doc_df_elem_ret_rerank_hidden],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
)
|
349 |
|
350 |
set_listeners(
|
351 |
"long-doc",
|
352 |
+
doc_df_elem_ret_rerank,
|
353 |
+
doc_df_elem_ret_rerank_hidden,
|
354 |
search_bar,
|
355 |
version,
|
356 |
domains,
|
|
|
372 |
show_anonymous,
|
373 |
show_rev_ts,
|
374 |
],
|
375 |
+
doc_df_elem_ret_rerank,
|
376 |
queue=True,
|
377 |
)
|
378 |
with gr.TabItem("Retrieval Only", id=21):
|
379 |
with gr.Row():
|
380 |
with gr.Column(scale=1):
|
381 |
+
search_bar_ret = get_search_bar()
|
382 |
with gr.Column(scale=1):
|
383 |
+
models_ret = get_noreranking_dropdown()
|
384 |
+
|
385 |
+
_doc_df_ret = datastore.doc_fmt_df[
|
386 |
datastore.doc_fmt_df[COL_NAME_RERANKING_MODEL] == "NoReranker"
|
387 |
]
|
388 |
+
_doc_df_ret = reset_rank(_doc_df_ret)
|
389 |
+
doc_df_elem_ret = get_leaderboard_table(
|
390 |
+
_doc_df_ret, datastore.doc_types
|
391 |
)
|
392 |
|
393 |
+
_doc_df_ret_hidden = datastore.doc_raw_df[
|
394 |
datastore.doc_raw_df[COL_NAME_RERANKING_MODEL] == "NoReranker"
|
395 |
]
|
396 |
+
_doc_df_ret_hidden = reset_rank(_doc_df_ret_hidden)
|
397 |
+
doc_df_elem_ret_hidden = get_leaderboard_table(
|
398 |
+
_doc_df_ret_hidden, datastore.doc_types, visible=False
|
399 |
)
|
400 |
|
401 |
version.change(
|
402 |
update_doc_version,
|
403 |
+
version,
|
404 |
+
[domains, langs, models_ret, doc_df_elem_ret, doc_df_elem_ret_hidden],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
)
|
406 |
|
407 |
set_listeners(
|
408 |
"long-doc",
|
409 |
+
doc_df_elem_ret,
|
410 |
+
doc_df_elem_ret_hidden,
|
411 |
+
search_bar_ret,
|
412 |
version,
|
413 |
domains,
|
414 |
langs,
|
415 |
+
models_ret,
|
416 |
show_anonymous,
|
417 |
show_rev_ts,
|
418 |
)
|
|
|
423 |
metric,
|
424 |
domains,
|
425 |
langs,
|
426 |
+
models_ret,
|
427 |
+
search_bar_ret,
|
428 |
show_anonymous,
|
429 |
show_rev_ts,
|
430 |
],
|
431 |
+
doc_df_elem_ret,
|
432 |
queue=True,
|
433 |
)
|
434 |
with gr.TabItem("Reranking Only", id=22):
|
435 |
+
_doc_df_rerank = datastore.doc_fmt_df[
|
436 |
datastore.doc_fmt_df[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
437 |
]
|
438 |
+
_doc_df_rerank = reset_rank(_doc_df_rerank)
|
439 |
+
doc_rerank_models = (
|
440 |
+
_doc_df_rerank[COL_NAME_RERANKING_MODEL].apply(remove_html).unique().tolist()
|
441 |
)
|
442 |
with gr.Row():
|
443 |
with gr.Column(scale=1):
|
444 |
+
doc_models_rerank = get_reranking_dropdown(
|
445 |
+
doc_rerank_models
|
446 |
)
|
447 |
with gr.Column(scale=1):
|
448 |
+
doc_search_bar_rerank = gr.Textbox(show_label=False, visible=False)
|
449 |
+
doc_df_elem_rerank = get_leaderboard_table(_doc_df_rerank, datastore.doc_types)
|
450 |
+
_doc_df_rerank_hidden = datastore.doc_raw_df[
|
451 |
datastore.doc_raw_df[COL_NAME_RETRIEVAL_MODEL] == BM25_LINK
|
452 |
]
|
453 |
+
_doc_df_rerank_hidden = reset_rank(_doc_df_rerank_hidden)
|
454 |
+
doc_df_elem_rerank_hidden = get_leaderboard_table(
|
455 |
+
_doc_df_rerank_hidden, datastore.doc_types, visible=False
|
456 |
)
|
457 |
|
458 |
version.change(
|
459 |
update_doc_version,
|
460 |
+
version,
|
461 |
+
[domains, langs, doc_models_rerank, doc_df_elem_rerank, doc_df_elem_rerank_hidden],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
)
|
463 |
|
464 |
set_listeners(
|
465 |
"long-doc",
|
466 |
+
doc_df_elem_rerank,
|
467 |
+
doc_df_elem_rerank_hidden,
|
468 |
+
doc_search_bar_rerank,
|
469 |
version,
|
470 |
domains,
|
471 |
langs,
|
472 |
+
doc_models_rerank,
|
473 |
show_anonymous,
|
474 |
show_rev_ts,
|
475 |
)
|
476 |
+
|
477 |
metric.change(
|
478 |
update_doc_metric,
|
479 |
[
|
480 |
metric,
|
481 |
domains,
|
482 |
langs,
|
483 |
+
doc_models_rerank,
|
484 |
+
doc_search_bar_rerank,
|
485 |
show_anonymous,
|
486 |
show_rev_ts,
|
487 |
],
|
488 |
+
doc_df_elem_rerank,
|
489 |
queue=True,
|
490 |
)
|
491 |
|