Anon commited on
Commit
e15c23c
·
1 Parent(s): 3713d67

small fixes.

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +26 -29
src/streamlit_app.py CHANGED
@@ -72,42 +72,39 @@ else:
72
  else:
73
  gifs_df = pd.DataFrame(rows)
74
 
75
- # Dropdowns (4-tuple)
76
- feature_options = sorted(gifs_df["features"].unique().tolist())
77
- hidden_options = sorted(gifs_df["hidden_dim"].unique().tolist())
78
- outof_options = sorted(gifs_df["sparsity_out_of"].unique().tolist())
79
-
80
- c1, c2, c3, c4 = st.columns([1, 1, 1, 1], gap="small")
81
- with c1:
82
- selected_features = st.selectbox("nf (features)", feature_options)
83
- with c2:
84
- selected_hidden = st.selectbox("nh (hidden dim)", hidden_options)
85
- with c3:
86
- selected_outof = st.selectbox("ni (out of)", outof_options)
87
-
88
- # sparsity options depend on the first 3 selections, so compute them dynamically
89
- sparsity_options = sorted(
90
- gifs_df[
91
- (gifs_df["features"] == selected_features)
92
- & (gifs_df["hidden_dim"] == selected_hidden)
93
- & (gifs_df["sparsity_out_of"] == selected_outof)
94
- ]["sparsity"].unique().tolist()
95
  )
96
 
97
- with c4:
98
- selected_sparsity = st.selectbox(
99
- "instance+1 (sparsity)",
100
- sparsity_options if sparsity_options else [None],
101
- disabled=(len(sparsity_options) == 0),
102
- )
103
 
104
- # Filter on the full 4-tuple
 
 
 
 
 
 
 
 
 
 
 
105
  filtered = gifs_df[
106
  (gifs_df["features"] == selected_features)
107
  & (gifs_df["hidden_dim"] == selected_hidden)
108
- & (gifs_df["sparsity_out_of"] == selected_outof)
109
  & (gifs_df["sparsity"] == selected_sparsity)
110
- ].copy()
 
 
111
 
112
  if filtered.empty:
113
  st.info("No GIFs found for that (nf, nh) combination.")
 
72
  else:
73
  gifs_df = pd.DataFrame(rows)
74
 
75
+ # Single dropdown selecting a 4-tuple (nf, nh, sparsity, out_of)
76
+ tuples_df = (
77
+ gifs_df[["features", "hidden_dim", "sparsity", "sparsity_out_of"]]
78
+ .drop_duplicates()
79
+ .sort_values(["features", "hidden_dim", "sparsity_out_of", "sparsity"])
80
+ .reset_index(drop=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  )
82
 
83
+ # readable labels
84
+ labels = [
85
+ f"nf={r.features}, nh={r.hidden_dim}, sparsity={r.sparsity}/{r.sparsity_out_of}"
86
+ for r in tuples_df.itertuples(index=False)
87
+ ]
 
88
 
89
+ selected_label = st.selectbox("Select (nf, nh, sparsity/out_of)", labels)
90
+
91
+ # decode selection
92
+ idx = labels.index(selected_label)
93
+ sel = tuples_df.iloc[idx]
94
+
95
+ selected_features = int(sel["features"])
96
+ selected_hidden = int(sel["hidden_dim"])
97
+ selected_sparsity = int(sel["sparsity"])
98
+ selected_outof = int(sel["sparsity_out_of"])
99
+
100
+ # Filter on full 4-tuple
101
  filtered = gifs_df[
102
  (gifs_df["features"] == selected_features)
103
  & (gifs_df["hidden_dim"] == selected_hidden)
 
104
  & (gifs_df["sparsity"] == selected_sparsity)
105
+ & (gifs_df["sparsity_out_of"] == selected_outof)
106
+ ].copy()
107
+
108
 
109
  if filtered.empty:
110
  st.info("No GIFs found for that (nf, nh) combination.")