agh123 commited on
Commit
6154159
·
1 Parent(s): 8121e85
Files changed (2) hide show
  1. src/app.py +80 -6
  2. src/components/filters.py +24 -39
src/app.py CHANGED
@@ -3,7 +3,7 @@ import streamlit as st
3
  import pandas as pd
4
  from typing import Optional, List, Set, Tuple
5
 
6
- from .components.filters import render_table_filters, render_plot_filters
7
  from .components.visualizations import (
8
  render_leaderboard_table,
9
  render_performance_plots,
@@ -13,7 +13,20 @@ from .services.firebase import fetch_leaderboard_data
13
  from .core.styles import CUSTOM_CSS
14
 
15
 
16
- def get_filter_values(df: pd.DataFrame) -> tuple[List[str], List[str], List[str], List[str], List[str], Tuple[int, int], Tuple[int, int], Tuple[int, int], List[str], int]:
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  """Get unique values for filters"""
18
  models = sorted(df["Model ID"].unique().tolist())
19
  platforms = sorted(df["Platform"].unique().tolist())
@@ -25,7 +38,18 @@ def get_filter_values(df: pd.DataFrame) -> tuple[List[str], List[str], List[str]
25
  pp_range = (df["PP Config"].min(), df["PP Config"].max())
26
  tg_range = (df["TG Config"].min(), df["TG Config"].max())
27
  versions = sorted(df["Version"].unique().tolist())
28
- return models, platforms, devices, cache_type_v, cache_type_k, pp_range, tg_range, n_threads, versions, max_n_gpu_layers
 
 
 
 
 
 
 
 
 
 
 
29
 
30
 
31
  async def main():
@@ -50,10 +74,32 @@ async def main():
50
  render_header()
51
 
52
  # Get unique values for filters
53
- models, platforms, devices, cache_type_v, cache_type_k, pp_range, tg_range, n_threads, versions, max_n_gpu_layers = get_filter_values(df)
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  # Render filters
56
- table_filters = render_table_filters(models, platforms, devices, cache_type_v, cache_type_k, pp_range, tg_range, n_threads, versions, max_n_gpu_layers)
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  # Render the main leaderboard table
59
  render_leaderboard_table(df, table_filters)
@@ -61,7 +107,35 @@ async def main():
61
  # Render plot section
62
  st.markdown("---")
63
  st.title("📊 Performance Comparison")
64
- plot_filters = render_plot_filters(models, platforms, devices, cache_type_v, cache_type_k, pp_range, tg_range, n_threads, versions, max_n_gpu_layers)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  render_performance_plots(df, plot_filters)
66
 
67
 
 
3
  import pandas as pd
4
  from typing import Optional, List, Set, Tuple
5
 
6
+ from .components.filters import render_table_filters
7
  from .components.visualizations import (
8
  render_leaderboard_table,
9
  render_performance_plots,
 
13
  from .core.styles import CUSTOM_CSS
14
 
15
 
16
+ def get_filter_values(
17
+ df: pd.DataFrame,
18
+ ) -> tuple[
19
+ List[str],
20
+ List[str],
21
+ List[str],
22
+ List[str],
23
+ List[str],
24
+ Tuple[int, int],
25
+ Tuple[int, int],
26
+ Tuple[int, int],
27
+ List[str],
28
+ int,
29
+ ]:
30
  """Get unique values for filters"""
31
  models = sorted(df["Model ID"].unique().tolist())
32
  platforms = sorted(df["Platform"].unique().tolist())
 
38
  pp_range = (df["PP Config"].min(), df["PP Config"].max())
39
  tg_range = (df["TG Config"].min(), df["TG Config"].max())
40
  versions = sorted(df["Version"].unique().tolist())
41
+ return (
42
+ models,
43
+ platforms,
44
+ devices,
45
+ cache_type_v,
46
+ cache_type_k,
47
+ pp_range,
48
+ tg_range,
49
+ n_threads,
50
+ versions,
51
+ max_n_gpu_layers,
52
+ )
53
 
54
 
55
  async def main():
 
74
  render_header()
75
 
76
  # Get unique values for filters
77
+ (
78
+ models,
79
+ platforms,
80
+ devices,
81
+ cache_type_v,
82
+ cache_type_k,
83
+ pp_range,
84
+ tg_range,
85
+ n_threads,
86
+ versions,
87
+ max_n_gpu_layers,
88
+ ) = get_filter_values(df)
89
 
90
  # Render filters
91
+ table_filters = render_table_filters(
92
+ models,
93
+ platforms,
94
+ devices,
95
+ cache_type_v,
96
+ cache_type_k,
97
+ pp_range,
98
+ tg_range,
99
+ n_threads,
100
+ versions,
101
+ max_n_gpu_layers,
102
+ )
103
 
104
  # Render the main leaderboard table
105
  render_leaderboard_table(df, table_filters)
 
107
  # Render plot section
108
  st.markdown("---")
109
  st.title("📊 Performance Comparison")
110
+
111
+ # Plot specific selectors in a row
112
+ plot_col1, plot_col2, plot_col3 = st.columns(3)
113
+
114
+ with plot_col1:
115
+ plot_model = st.selectbox(
116
+ "Select Model for Comparison", options=models, key="plot_model_selector"
117
+ )
118
+
119
+ with plot_col2:
120
+ plot_pp = st.selectbox(
121
+ "Select PP Config for Comparison",
122
+ options=sorted([int(x) for x in df["PP Config"].unique()]),
123
+ key="plot_pp_selector",
124
+ )
125
+
126
+ with plot_col3:
127
+ plot_tg = st.selectbox(
128
+ "Select TG Config for Comparison",
129
+ options=sorted([int(x) for x in df["TG Config"].unique()]),
130
+ key="plot_tg_selector",
131
+ )
132
+
133
+ # Create plot filters based on table filters but override the model and configs
134
+ plot_filters = table_filters.copy()
135
+ plot_filters["model"] = plot_model
136
+ plot_filters["pp_range"] = (plot_pp, plot_pp) # Set exact PP value
137
+ plot_filters["tg_range"] = (plot_tg, plot_tg) # Set exact TG value
138
+
139
  render_performance_plots(df, plot_filters)
140
 
141
 
src/components/filters.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
  from typing import List, Tuple, Dict, Set
3
 
4
 
5
- def render_grouping_options() -> List[str]:
6
  """Render grouping options selector"""
7
  available_groups = [
8
  "Model ID",
@@ -38,6 +38,7 @@ def render_grouping_options() -> List[str]:
38
  options=available_groups,
39
  default=default_groups,
40
  help="Select columns to group the results by",
 
41
  )
42
 
43
  return selected_groups
@@ -125,12 +126,13 @@ def render_filters(
125
  n_threads: Tuple[int, int],
126
  versions: List[str],
127
  max_n_gpu_layers: int,
 
128
  ) -> Dict:
129
  """Render all filters in a compact two-row layout"""
130
  filters = {}
131
 
132
  # Row 1: Grouping
133
- filters["grouping"] = render_grouping_options()
134
 
135
  # st.markdown("**Filters**")
136
  # Row 2: All filters in columns
@@ -138,7 +140,10 @@ def render_filters(
138
 
139
  ##with col1:
140
  filters["model"] = st.selectbox(
141
- "Model", options=["All"] + models, key="filter_model", help="Filters"
 
 
 
142
  )
143
 
144
  # Row 2 continued
@@ -146,27 +151,33 @@ def render_filters(
146
 
147
  with col2:
148
  filters["platform"] = st.selectbox(
149
- "Platform", options=["All"] + platforms, key="filter_platform"
150
  )
151
 
152
  with col3:
153
  filters["device"] = st.selectbox(
154
- "Device", options=["All"] + devices, key="filter_device"
155
  )
156
 
157
  with col4:
158
  filters["flash_attn"] = st.selectbox(
159
- "Flash Attention", options=["All", True, False], key="filter_flash_attn"
 
 
160
  )
161
 
162
  with col5:
163
  filters["cache_type_k"] = st.selectbox(
164
- "Cache Type K", options=["All"] + cache_type_k, key="filter_cache_type_k"
 
 
165
  )
166
 
167
  with col6:
168
  filters["cache_type_v"] = st.selectbox(
169
- "Cache Type V", options=["All"] + cache_type_v, key="filter_cache_type_v"
 
 
170
  )
171
 
172
  with col7:
@@ -176,7 +187,7 @@ def render_filters(
176
  max_value=pp_range[1],
177
  value=pp_range,
178
  step=32,
179
- key="filter_pp",
180
  )
181
 
182
  with col8:
@@ -186,7 +197,7 @@ def render_filters(
186
  max_value=tg_range[1],
187
  value=tg_range,
188
  step=32,
189
- key="filter_tg",
190
  )
191
 
192
  with col9:
@@ -195,12 +206,12 @@ def render_filters(
195
  min_value=n_threads[0],
196
  max_value=n_threads[1],
197
  value=n_threads,
198
- key="filter_threads",
199
  )
200
 
201
  with col10:
202
  filters["Version"] = st.selectbox(
203
- "Version", options=["All"] + versions, key="filter_version"
204
  )
205
 
206
  # Column visibility control as a small button/dropdown
@@ -233,31 +244,5 @@ def render_table_filters(
233
  n_threads,
234
  versions,
235
  max_n_gpu_layers,
236
- )
237
-
238
-
239
- def render_plot_filters(
240
- models: List[str],
241
- platforms: List[str],
242
- devices: List[str],
243
- cache_type_v: List[str],
244
- cache_type_k: List[str],
245
- pp_range: Tuple[int, int],
246
- tg_range: Tuple[int, int],
247
- n_threads: Tuple[int, int],
248
- versions: List[str],
249
- max_n_gpu_layers: int,
250
- ) -> Dict:
251
- """Main entry point for plot filters"""
252
- return render_filters(
253
- models,
254
- platforms,
255
- devices,
256
- cache_type_v,
257
- cache_type_k,
258
- pp_range,
259
- tg_range,
260
- n_threads,
261
- versions,
262
- max_n_gpu_layers,
263
  )
 
2
  from typing import List, Tuple, Dict, Set
3
 
4
 
5
+ def render_grouping_options(key_prefix: str = "") -> List[str]:
6
  """Render grouping options selector"""
7
  available_groups = [
8
  "Model ID",
 
38
  options=available_groups,
39
  default=default_groups,
40
  help="Select columns to group the results by",
41
+ key=f"{key_prefix}_group_by",
42
  )
43
 
44
  return selected_groups
 
126
  n_threads: Tuple[int, int],
127
  versions: List[str],
128
  max_n_gpu_layers: int,
129
+ key_prefix: str = "",
130
  ) -> Dict:
131
  """Render all filters in a compact two-row layout"""
132
  filters = {}
133
 
134
  # Row 1: Grouping
135
+ filters["grouping"] = render_grouping_options(key_prefix)
136
 
137
  # st.markdown("**Filters**")
138
  # Row 2: All filters in columns
 
140
 
141
  ##with col1:
142
  filters["model"] = st.selectbox(
143
+ "Model",
144
+ options=["All"] + models,
145
+ key=f"{key_prefix}_filter_model",
146
+ help="Filters",
147
  )
148
 
149
  # Row 2 continued
 
151
 
152
  with col2:
153
  filters["platform"] = st.selectbox(
154
+ "Platform", options=["All"] + platforms, key=f"{key_prefix}_filter_platform"
155
  )
156
 
157
  with col3:
158
  filters["device"] = st.selectbox(
159
+ "Device", options=["All"] + devices, key=f"{key_prefix}_filter_device"
160
  )
161
 
162
  with col4:
163
  filters["flash_attn"] = st.selectbox(
164
+ "Flash Attention",
165
+ options=["All", True, False],
166
+ key=f"{key_prefix}_filter_flash_attn",
167
  )
168
 
169
  with col5:
170
  filters["cache_type_k"] = st.selectbox(
171
+ "Cache Type K",
172
+ options=["All"] + cache_type_k,
173
+ key=f"{key_prefix}_filter_cache_type_k",
174
  )
175
 
176
  with col6:
177
  filters["cache_type_v"] = st.selectbox(
178
+ "Cache Type V",
179
+ options=["All"] + cache_type_v,
180
+ key=f"{key_prefix}_filter_cache_type_v",
181
  )
182
 
183
  with col7:
 
187
  max_value=pp_range[1],
188
  value=pp_range,
189
  step=32,
190
+ key=f"{key_prefix}_filter_pp",
191
  )
192
 
193
  with col8:
 
197
  max_value=tg_range[1],
198
  value=tg_range,
199
  step=32,
200
+ key=f"{key_prefix}_filter_tg",
201
  )
202
 
203
  with col9:
 
206
  min_value=n_threads[0],
207
  max_value=n_threads[1],
208
  value=n_threads,
209
+ key=f"{key_prefix}_filter_threads",
210
  )
211
 
212
  with col10:
213
  filters["Version"] = st.selectbox(
214
+ "Version", options=["All"] + versions, key=f"{key_prefix}_filter_version"
215
  )
216
 
217
  # Column visibility control as a small button/dropdown
 
244
  n_threads,
245
  versions,
246
  max_n_gpu_layers,
247
+ key_prefix="table",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  )