Spaces:
Running
Running
File size: 1,940 Bytes
2fcb72a aa8b4d6 2fcb72a c113723 2fcb72a c113723 2fcb72a aa8b4d6 2fcb72a |
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
import gradio as gr
from src.utils import model_hyperlink
LEADERBOARD_COLUMN_TO_DATATYPE = {
# open llm
"Model": "str",
"Quantization": "str",
# primary measurements
"Prefill (tokens/s)": "number",
"Decode (tokens/s)": "number",
"Model Size (GB)": "number",
# deployment settings
"Backend": "str",
# additional measurements
# "Reserved Memory (MB)": "number",
# "Used Memory (MB)": "number",
"Params (B)": "number",
"MMLU Accuracy": "number",
}
PRIMARY_COLUMNS = [
"Model",
"Quantization",
"Prefill (tokens/s)",
"Decode (tokens/s)",
"Model Size (GB)",
"MMLU Accuracy"
]
def process_model(model_name):
link = f"https://huggingface.co/{model_name}"
return model_hyperlink(link, model_name)
def get_leaderboard_df(llm_perf_df):
df = llm_perf_df.copy()
# transform for leaderboard
# df["Model"] = df["Model"].apply(process_model)
return df
def create_leaderboard_table(llm_perf_df):
# get dataframe
leaderboard_df = get_leaderboard_df(llm_perf_df)
# create search bar
with gr.Row():
search_bar = gr.Textbox(
label="Model",
info="π Search for a model name",
elem_id="search-bar",
)
# create checkboxes
with gr.Row():
columns_checkboxes = gr.CheckboxGroup(
label="Columns π",
value=PRIMARY_COLUMNS,
choices=list(LEADERBOARD_COLUMN_TO_DATATYPE.keys()),
info="βοΈ Select the columns to display",
elem_id="columns-checkboxes",
)
# create table
leaderboard_table = gr.components.Dataframe(
value=leaderboard_df[PRIMARY_COLUMNS],
datatype=list(LEADERBOARD_COLUMN_TO_DATATYPE.values()),
headers=list(LEADERBOARD_COLUMN_TO_DATATYPE.keys()),
elem_id="leaderboard-table",
)
return search_bar, columns_checkboxes, leaderboard_table
|