Spaces:
Running
Running
File size: 5,906 Bytes
ab5f5f1 affd732 ab5f5f1 a1135a9 ab5f5f1 a1135a9 ab5f5f1 a1135a9 ab5f5f1 affd732 ab5f5f1 affd732 ab5f5f1 2460b35 ab5f5f1 2460b35 ab5f5f1 |
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
import gradio as gr
from src.llm_perf import get_llm_perf_df
from src.leaderboard import get_leaderboard_df
from src.latency_score_memory import get_lat_score_mem_fig
from src.bettertransformer import get_bt_prefill_fig, get_bt_decode_fig
from src.flashattentionv2 import get_fa2_prefill_fig, get_fa2_decode_fig
from src.exllama import get_exllama_prefill_fig, get_exllama_decode_fig
def create_control_panel(machine: str = "hf-dgx-01"):
# descriptive text
gr.HTML("Use this control panel to filter this leaderboard.", elem_id="text")
# controls
machine_textbox = gr.Textbox(value=machine, visible=False)
with gr.Row():
with gr.Column():
search_bar = gr.Textbox(
label="Model π€",
info="π Search for a model name",
elem_id="search-bar",
)
with gr.Row():
with gr.Column(scale=1):
score_slider = gr.Slider(
label="Open LLM Score (%) π",
info="ποΈ Slide to minimum Open LLM score",
value=0,
elem_id="threshold-slider",
)
with gr.Column(scale=1):
memory_slider = gr.Slider(
label="Peak Memory (MB) π",
info="ποΈ Slide to maximum Peak Memory",
minimum=0,
maximum=80 * 1024,
value=80 * 1024,
elem_id="memory-slider",
)
with gr.Column(scale=1):
backend_checkboxes = gr.CheckboxGroup(
label="Backends π",
choices=["pytorch"],
value=["pytorch"],
info="βοΈ Select the backends",
elem_id="backend-checkboxes",
)
with gr.Row():
with gr.Column(scale=1):
datatype_checkboxes = gr.CheckboxGroup(
label="Load DTypes π₯",
choices=["float32", "float16", "bfloat16"],
value=["float32", "float16", "bfloat16"],
info="βοΈ Select the load data types",
elem_id="dtype-checkboxes",
)
with gr.Column(scale=1):
optimization_checkboxes = gr.CheckboxGroup(
label="Optimizations π οΈ",
choices=["None", "BetterTransformer", "FlashAttentionV2"],
value=["None", "BetterTransformer", "FlashAttentionV2"],
info="βοΈ Select the optimization",
elem_id="optimization-checkboxes",
)
with gr.Column(scale=1):
quantization_checkboxes = gr.CheckboxGroup(
label="Quantizations ποΈ",
choices=["None", "BnB.4bit", "BnB.8bit", "GPTQ.4bit", "GPTQ.4bit+ExllamaV1", "GPTQ.4bit+ExllamaV2"],
value=["None", "BnB.4bit", "BnB.8bit", "GPTQ.4bit", "GPTQ.4bit+ExllamaV1", "GPTQ.4bit+ExllamaV2"],
info="βοΈ Select the quantization schemes",
elem_id="quantization-checkboxes",
)
with gr.Row():
filter_button = gr.Button(
value="Filter π",
elem_id="filter-button",
)
return (
filter_button,
machine_textbox,
search_bar,
score_slider,
memory_slider,
backend_checkboxes,
datatype_checkboxes,
optimization_checkboxes,
quantization_checkboxes,
)
def filter_fn(
machine,
model,
backends,
datatypes,
optimizations,
quantizations,
score,
memory,
):
raw_df = get_llm_perf_df(machine=machine)
filtered_df = raw_df[
raw_df["Model π€"].str.contains(model, case=False)
& raw_df["Backend π"].isin(backends)
& raw_df["DType π₯"].isin(datatypes)
& raw_df["Optimization π οΈ"].isin(optimizations)
& raw_df["Quantization ποΈ"].isin(quantizations)
& (raw_df["Open LLM Score (%)"] >= score)
& (raw_df["Allocated Memory (MB)"] <= memory)
]
filtered_leaderboard_df = get_leaderboard_df(filtered_df)
filtered_lat_score_mem_fig = get_lat_score_mem_fig(filtered_df)
filtered_bt_prefill_fig = get_bt_prefill_fig(filtered_df)
filtered_bt_decode_fig = get_bt_decode_fig(filtered_df)
filtered_fa2_prefill_fig = get_fa2_prefill_fig(filtered_df)
filtered_fa2_decode_fig = get_fa2_decode_fig(filtered_df)
filtered_exllama_prefill_fig = get_exllama_prefill_fig(filtered_df)
filtered_exllama_decode_fig = get_exllama_decode_fig(filtered_df)
return [
filtered_leaderboard_df,
filtered_lat_score_mem_fig,
filtered_bt_prefill_fig,
filtered_bt_decode_fig,
filtered_fa2_prefill_fig,
filtered_fa2_decode_fig,
filtered_exllama_prefill_fig,
filtered_exllama_decode_fig,
]
def create_control_callback(
# button
filter_button,
# inputs
machine_textbox,
search_bar,
score_slider,
memory_slider,
backend_checkboxes,
datatype_checkboxes,
optimization_checkboxes,
quantization_checkboxes,
# outputs
leaderboard_table,
lat_score_mem_plot,
bt_prefill_plot,
bt_decode_plot,
fa2_prefill_plot,
fa2_decode_plot,
exllama_prefill_plot,
exllama_decode_plot,
):
filter_button.click(
fn=filter_fn,
inputs=[
machine_textbox,
search_bar,
backend_checkboxes,
datatype_checkboxes,
optimization_checkboxes,
quantization_checkboxes,
score_slider,
memory_slider,
],
outputs=[
leaderboard_table,
lat_score_mem_plot,
bt_prefill_plot,
bt_decode_plot,
fa2_prefill_plot,
fa2_decode_plot,
exllama_prefill_plot,
exllama_decode_plot,
],
)
|