File size: 1,190 Bytes
bbaf3a3
 
 
 
 
 
 
 
 
 
 
 
ff00b3b
bbaf3a3
ff00b3b
bbaf3a3
 
 
 
ff00b3b
 
bbaf3a3
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import gradio as gr, pandas as pd, datetime as dt
from huggingface_hub import hf_hub_download

DATASET = "Mdrnfox/peft-bench-metrics"
PQ_PATH = "data/peft_bench.parquet"

def load_table():
    local = hf_hub_download(DATASET, PQ_PATH, repo_type="dataset")
    df_long = pd.read_parquet(local)

    wide = (
        df_long
        .query("metric != 'alias'")  # drop alias
        .pivot_table(index=["model_id", "task"],
                     columns=["metric", "aggregation"],
                     values="value")
        .reset_index()
        .sort_values(["task", "model_id"])
    )

    wide.columns = ['_'.join(filter(None, map(str, col))).strip() for col in wide.columns.values]
    return wide

def refresh():
    return gr.DataFrame.update(value=load_table(),
                               headers=None), f"Last updated {dt.datetime.utcnow():%Y-%m-%d %H:%M UTC}"

with gr.Blocks(title="PEFT-Bench") as demo:
    gr.Markdown("# PEFT-Bench Leaderboard")
    df = gr.DataFrame(value=load_table(), interactive=False, wrap=True)
    t  = gr.Markdown(f"Last updated {dt.datetime.utcnow():%Y-%m-%d %H:%M UTC}")
    gr.Button("↻ Refresh").click(refresh, outputs=[df, t])

demo.launch()