Hch Li
commited on
Commit
·
200e56a
1
Parent(s):
c050e6e
add vis
Browse files
app.py
CHANGED
|
@@ -52,11 +52,18 @@ def filter_and_display(selected_columns, model_types, datasets, stage):
|
|
| 52 |
display_columns = ["Method", "Model"] + [col for col in selected_columns if col in filtered.columns]
|
| 53 |
return filtered[display_columns] if not filtered.empty else pd.DataFrame(columns=display_columns)
|
| 54 |
|
| 55 |
-
def
|
| 56 |
if filtered_data.empty:
|
| 57 |
return None
|
| 58 |
fig = px.bar(filtered_data, x='Model', y='Quality', color='Method', barmode='group',
|
| 59 |
-
title='Quality by Model and Method')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
return fig
|
| 61 |
|
| 62 |
# Load the data from the /data folder
|
|
@@ -109,6 +116,11 @@ This demo leaderboard allows users to explore and compare different KV cache imp
|
|
| 109 |
|
| 110 |
prefill_results = gr.Dataframe(value=filter_and_display(["Quality", "TTFT"], list(data["Model"].unique()), list(data["Dataset"].unique()), "prefill"), headers=["Method", "Model", "Quality", "TTFT", "Link"])
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
# Decode-stage selection
|
| 113 |
with gr.Row():
|
| 114 |
gr.Markdown("## Decode-stage Selection")
|
|
@@ -143,27 +155,30 @@ This demo leaderboard allows users to explore and compare different KV cache imp
|
|
| 143 |
|
| 144 |
decode_results = gr.Dataframe(value=filter_and_display(["Throughput (token/s)", "Quality"], list(data["Model"].unique()), list(data["Dataset"].unique()), "decode"), headers=["Method", "Model", "Throughput (token/s)", "Quality", "Link"])
|
| 145 |
|
|
|
|
| 146 |
with gr.Row():
|
| 147 |
-
gr.Markdown("### Visualization")
|
| 148 |
-
|
| 149 |
|
| 150 |
def auto_update_prefill(selected_columns, model_types, datasets):
|
| 151 |
if not model_types or not datasets:
|
| 152 |
-
return pd.DataFrame(columns=["Method", "Model"] + selected_columns)
|
| 153 |
-
|
|
|
|
| 154 |
|
| 155 |
def auto_update_decode(selected_columns, model_types, datasets):
|
| 156 |
if not model_types or not datasets:
|
| 157 |
-
return pd.DataFrame(columns=["Method", "Model"] + selected_columns)
|
| 158 |
-
|
|
|
|
| 159 |
|
| 160 |
-
prefill_columns_to_display.change(auto_update_prefill, inputs=[prefill_columns_to_display, prefill_model_types, prefill_datasets], outputs=[prefill_results])
|
| 161 |
-
prefill_model_types.change(auto_update_prefill, inputs=[prefill_columns_to_display, prefill_model_types, prefill_datasets], outputs=[prefill_results])
|
| 162 |
-
prefill_datasets.change(auto_update_prefill, inputs=[prefill_columns_to_display, prefill_model_types, prefill_datasets], outputs=[prefill_results])
|
| 163 |
|
| 164 |
-
decode_columns_to_display.change(auto_update_decode, inputs=[decode_columns_to_display, decode_model_types, decode_datasets], outputs=[decode_results])
|
| 165 |
-
decode_model_types.change(auto_update_decode, inputs=[decode_columns_to_display, decode_model_types, decode_datasets], outputs=[decode_results])
|
| 166 |
-
decode_datasets.change(auto_update_decode, inputs=[decode_columns_to_display, decode_model_types, decode_datasets], outputs=[decode_results])
|
| 167 |
|
| 168 |
# Add a reload button
|
| 169 |
def reload_data():
|
|
@@ -171,10 +186,11 @@ This demo leaderboard allows users to explore and compare different KV cache imp
|
|
| 171 |
data = load_data(data_dir)
|
| 172 |
return (filter_and_display(prefill_columns_to_display.value, prefill_model_types.value, prefill_datasets.value, "prefill"),
|
| 173 |
filter_and_display(decode_columns_to_display.value, decode_model_types.value, decode_datasets.value, "decode"),
|
| 174 |
-
|
|
|
|
| 175 |
|
| 176 |
reload_button = gr.Button("Reload Data")
|
| 177 |
-
reload_button.click(reload_data, outputs=[prefill_results, decode_results,
|
| 178 |
|
| 179 |
with gr.TabItem("About"):
|
| 180 |
gr.Markdown(about_markdown) # Use the imported about page content
|
|
|
|
| 52 |
display_columns = ["Method", "Model"] + [col for col in selected_columns if col in filtered.columns]
|
| 53 |
return filtered[display_columns] if not filtered.empty else pd.DataFrame(columns=display_columns)
|
| 54 |
|
| 55 |
+
def create_prefill_visualization(filtered_data):
|
| 56 |
if filtered_data.empty:
|
| 57 |
return None
|
| 58 |
fig = px.bar(filtered_data, x='Model', y='Quality', color='Method', barmode='group',
|
| 59 |
+
title='Prefill Stage: Quality by Model and Method')
|
| 60 |
+
return fig
|
| 61 |
+
|
| 62 |
+
def create_decode_visualization(filtered_data):
|
| 63 |
+
if filtered_data.empty:
|
| 64 |
+
return None
|
| 65 |
+
fig = px.bar(filtered_data, x='Model', y='Throughput (token/s)', color='Method', barmode='group',
|
| 66 |
+
title='Decode Stage: Throughput by Model and Method')
|
| 67 |
return fig
|
| 68 |
|
| 69 |
# Load the data from the /data folder
|
|
|
|
| 116 |
|
| 117 |
prefill_results = gr.Dataframe(value=filter_and_display(["Quality", "TTFT"], list(data["Model"].unique()), list(data["Dataset"].unique()), "prefill"), headers=["Method", "Model", "Quality", "TTFT", "Link"])
|
| 118 |
|
| 119 |
+
# Prefill-stage visualization
|
| 120 |
+
with gr.Row():
|
| 121 |
+
gr.Markdown("### Prefill-stage Visualization")
|
| 122 |
+
prefill_plot = gr.Plot(value=create_prefill_visualization(filter_and_display(["Quality"], list(data["Model"].unique()), list(data["Dataset"].unique()), "prefill")))
|
| 123 |
+
|
| 124 |
# Decode-stage selection
|
| 125 |
with gr.Row():
|
| 126 |
gr.Markdown("## Decode-stage Selection")
|
|
|
|
| 155 |
|
| 156 |
decode_results = gr.Dataframe(value=filter_and_display(["Throughput (token/s)", "Quality"], list(data["Model"].unique()), list(data["Dataset"].unique()), "decode"), headers=["Method", "Model", "Throughput (token/s)", "Quality", "Link"])
|
| 157 |
|
| 158 |
+
# Decode-stage visualization
|
| 159 |
with gr.Row():
|
| 160 |
+
gr.Markdown("### Decode-stage Visualization")
|
| 161 |
+
decode_plot = gr.Plot(value=create_decode_visualization(filter_and_display(["Throughput (token/s)"], list(data["Model"].unique()), list(data["Dataset"].unique()), "decode")))
|
| 162 |
|
| 163 |
def auto_update_prefill(selected_columns, model_types, datasets):
|
| 164 |
if not model_types or not datasets:
|
| 165 |
+
return pd.DataFrame(columns=["Method", "Model"] + selected_columns), None
|
| 166 |
+
filtered_data = filter_and_display(selected_columns, model_types, datasets, "prefill")
|
| 167 |
+
return filtered_data, create_prefill_visualization(filtered_data)
|
| 168 |
|
| 169 |
def auto_update_decode(selected_columns, model_types, datasets):
|
| 170 |
if not model_types or not datasets:
|
| 171 |
+
return pd.DataFrame(columns=["Method", "Model"] + selected_columns), None
|
| 172 |
+
filtered_data = filter_and_display(selected_columns, model_types, datasets, "decode")
|
| 173 |
+
return filtered_data, create_decode_visualization(filtered_data)
|
| 174 |
|
| 175 |
+
prefill_columns_to_display.change(auto_update_prefill, inputs=[prefill_columns_to_display, prefill_model_types, prefill_datasets], outputs=[prefill_results, prefill_plot])
|
| 176 |
+
prefill_model_types.change(auto_update_prefill, inputs=[prefill_columns_to_display, prefill_model_types, prefill_datasets], outputs=[prefill_results, prefill_plot])
|
| 177 |
+
prefill_datasets.change(auto_update_prefill, inputs=[prefill_columns_to_display, prefill_model_types, prefill_datasets], outputs=[prefill_results, prefill_plot])
|
| 178 |
|
| 179 |
+
decode_columns_to_display.change(auto_update_decode, inputs=[decode_columns_to_display, decode_model_types, decode_datasets], outputs=[decode_results, decode_plot])
|
| 180 |
+
decode_model_types.change(auto_update_decode, inputs=[decode_columns_to_display, decode_model_types, decode_datasets], outputs=[decode_results, decode_plot])
|
| 181 |
+
decode_datasets.change(auto_update_decode, inputs=[decode_columns_to_display, decode_model_types, decode_datasets], outputs=[decode_results, decode_plot])
|
| 182 |
|
| 183 |
# Add a reload button
|
| 184 |
def reload_data():
|
|
|
|
| 186 |
data = load_data(data_dir)
|
| 187 |
return (filter_and_display(prefill_columns_to_display.value, prefill_model_types.value, prefill_datasets.value, "prefill"),
|
| 188 |
filter_and_display(decode_columns_to_display.value, decode_model_types.value, decode_datasets.value, "decode"),
|
| 189 |
+
create_prefill_visualization(filter_and_display(prefill_columns_to_display.value, prefill_model_types.value, prefill_datasets.value, "prefill")),
|
| 190 |
+
create_decode_visualization(filter_and_display(decode_columns_to_display.value, decode_model_types.value, decode_datasets.value, "decode")))
|
| 191 |
|
| 192 |
reload_button = gr.Button("Reload Data")
|
| 193 |
+
reload_button.click(reload_data, outputs=[prefill_results, decode_results, prefill_plot, decode_plot])
|
| 194 |
|
| 195 |
with gr.TabItem("About"):
|
| 196 |
gr.Markdown(about_markdown) # Use the imported about page content
|