Anon
commited on
Commit
·
e15c23c
1
Parent(s):
3713d67
small fixes.
Browse files- 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 |
-
#
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 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 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
)
|
| 103 |
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
]
|
|
|
|
|
|
|
| 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.")
|