Hch Li commited on
Commit
c4a74cb
·
1 Parent(s): cc2919a
__pycache__/about_content.cpython-310.pyc ADDED
Binary file (652 Bytes). View file
 
__pycache__/submission_content.cpython-310.pyc ADDED
Binary file (596 Bytes). View file
 
about_content.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # about_content.py
2
+
3
+ about_markdown = """
4
+ ### About Page
5
+
6
+ This application is a demonstration of KV Cache Benchmarking. It allows users to explore and compare different KV cache implementations across various models and datasets.
7
+
8
+ #### Features:
9
+ - Interactive filtering by model types and datasets
10
+ - Real-time updates of benchmark results
11
+ - Visualization of Quality and TTFT metrics
12
+
13
+ #### Contact:
14
+ For more information, please contact us at [email@example.com](mailto:email@example.com).
15
+ """
app.py CHANGED
@@ -2,6 +2,9 @@ import os
2
  import json
3
  import gradio as gr
4
  import pandas as pd
 
 
 
5
 
6
  # Helper function to load data from JSON files
7
  def load_data(data_dir):
@@ -37,6 +40,13 @@ def filter_and_display(selected_columns, model_types, datasets):
37
  display_columns = ["Method", "Model"] + [col for col in ["Quality", "TTFT", "Link"] if col in selected_columns]
38
  return filtered[display_columns] if not filtered.empty else pd.DataFrame(columns=display_columns)
39
 
 
 
 
 
 
 
 
40
  # Load the data from the /data folder
41
  data_dir = "data"
42
  data = load_data(data_dir)
@@ -46,9 +56,9 @@ def create_gradio_app():
46
  with gr.Blocks() as app:
47
  with gr.Row():
48
  gr.Markdown(
49
- """# KV Cache Benchmark
50
  ### Demo leaderboard
51
- Intro text
52
  """)
53
 
54
  with gr.Tabs():
@@ -83,17 +93,26 @@ Intro text
83
 
84
  results = gr.Dataframe(value=filter_and_display(["Quality", "TTFT"], list(data["Model"].unique()), list(data["Dataset"].unique())), headers=["Method", "Model", "Quality", "TTFT", "Link"])
85
 
 
 
 
 
86
  def auto_update(selected_columns, model_types, datasets):
87
  if not model_types or not datasets:
88
- return pd.DataFrame(columns=["Method", "Model"] + selected_columns)
89
- return filter_and_display(selected_columns, model_types, datasets)
 
 
 
 
 
90
 
91
- columns_to_display.change(auto_update, inputs=[columns_to_display, model_types, datasets], outputs=[results])
92
- model_types.change(auto_update, inputs=[columns_to_display, model_types, datasets], outputs=[results])
93
- datasets.change(auto_update, inputs=[columns_to_display, model_types, datasets], outputs=[results])
94
 
95
  with gr.TabItem("About"):
96
- gr.Markdown("### About Page Placeholder")
 
 
 
97
 
98
  return app
99
 
 
2
  import json
3
  import gradio as gr
4
  import pandas as pd
5
+ from about_content import about_markdown # Import the about page content
6
+ from submission_content import submission_markdown # Import the submission page content
7
+ import plotly.express as px
8
 
9
  # Helper function to load data from JSON files
10
  def load_data(data_dir):
 
40
  display_columns = ["Method", "Model"] + [col for col in ["Quality", "TTFT", "Link"] if col in selected_columns]
41
  return filtered[display_columns] if not filtered.empty else pd.DataFrame(columns=display_columns)
42
 
43
+ def create_visualization(filtered_data):
44
+ if filtered_data.empty:
45
+ return None
46
+ fig = px.bar(filtered_data, x='Model', y='Quality', color='Method', barmode='group',
47
+ title='Quality by Model and Method')
48
+ return fig
49
+
50
  # Load the data from the /data folder
51
  data_dir = "data"
52
  data = load_data(data_dir)
 
56
  with gr.Blocks() as app:
57
  with gr.Row():
58
  gr.Markdown(
59
+ """<h1 style="text-align: center; font-size: 3em;">KV Cache Benchmark</h1>
60
  ### Demo leaderboard
61
+ This demo leaderboard allows users to explore and compare different KV cache implementations across various models and datasets. It provides interactive filtering options and real-time updates of benchmark results, including visualization of Quality and TTFT metrics.
62
  """)
63
 
64
  with gr.Tabs():
 
93
 
94
  results = gr.Dataframe(value=filter_and_display(["Quality", "TTFT"], list(data["Model"].unique()), list(data["Dataset"].unique())), headers=["Method", "Model", "Quality", "TTFT", "Link"])
95
 
96
+ with gr.Row():
97
+ gr.Markdown("### Visualization")
98
+ plot = gr.Plot(value=create_visualization(data))
99
+
100
  def auto_update(selected_columns, model_types, datasets):
101
  if not model_types or not datasets:
102
+ return pd.DataFrame(columns=["Method", "Model"] + selected_columns), None
103
+ filtered_data = filter_and_display(selected_columns, model_types, datasets)
104
+ return filtered_data, create_visualization(filtered_data)
105
+
106
+ columns_to_display.change(auto_update, inputs=[columns_to_display, model_types, datasets], outputs=[results, plot])
107
+ model_types.change(auto_update, inputs=[columns_to_display, model_types, datasets], outputs=[results, plot])
108
+ datasets.change(auto_update, inputs=[columns_to_display, model_types, datasets], outputs=[results, plot])
109
 
 
 
 
110
 
111
  with gr.TabItem("About"):
112
+ gr.Markdown(about_markdown) # Use the imported about page content
113
+
114
+ with gr.TabItem("Submission Instructions"):
115
+ gr.Markdown(submission_markdown) # Use the imported submission page content
116
 
117
  return app
118
 
requirements.txt ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ APScheduler
2
+ black
3
+ datasets
4
+ gradio
5
+ gradio[oauth]
6
+ gradio_leaderboard==0.0.13
7
+ gradio_client
8
+ huggingface-hub>=0.18.0
9
+ matplotlib
10
+ numpy
11
+ pandas
12
+ python-dateutil
13
+ tqdm
14
+ transformers
15
+ plotly
16
+ tokenizers>=0.15.0
17
+ sentencepiece
submission_content.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ submission_markdown = """
2
+ ###Submission Instructions
3
+
4
+ Please follow these steps to submit your data:
5
+
6
+ 1. Prepare your data in JSON format.
7
+ 2. Ensure the file name follows the format: `method_model_dataset.json`.
8
+ 3. Upload your file to the `data` directory.
9
+ 4. Refresh the application to see your data in the leaderboard.
10
+
11
+ For any questions, contact us at [support@example.com](mailto:support@example.com).
12
+ """