Spaces:
Runtime error
Runtime error
Eric Mitchell
commited on
Commit
•
89e27db
1
Parent(s):
93798d6
Things working, I think?
Browse files
app.py
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
from turtle import onclick
|
2 |
import streamlit as st
|
3 |
import pandas as pd
|
|
|
4 |
|
5 |
EDIT_ALGS = [
|
6 |
-
"MEND: Model editor networks using gradient decomposition
|
7 |
-
"SERAC: Semi-parametric editing with a retrieval-augmented counterfactual model
|
8 |
-
"ENN: Editable
|
9 |
-
"KE: KnowledgeEditor
|
10 |
"Fine-tuning",
|
11 |
"Lookup Cache"
|
12 |
]
|
13 |
|
14 |
-
st.title("Model
|
|
|
|
|
15 |
|
16 |
# https://discuss.streamlit.io/t/simple-example-of-persistence-and-waiting-for-input/2111
|
17 |
@st.cache(allow_output_mutation=True)
|
@@ -28,8 +31,10 @@ model_outputs = ModelOutput()
|
|
28 |
def reset():
|
29 |
edits.drop(edits.index, inplace=True)
|
30 |
model_outputs.drop(edits.index, inplace=True)
|
31 |
-
|
32 |
-
st.
|
|
|
|
|
33 |
############# Need to reset the model here (and maybe show progress spinner?)
|
34 |
|
35 |
def apply_edit():
|
@@ -38,7 +43,7 @@ def apply_edit():
|
|
38 |
def sample_model():
|
39 |
model_outputs.loc[len(model_outputs)] = [str(test_input), "blah blah blah", len(edits)]
|
40 |
|
41 |
-
alg_selector = st.selectbox("Editing algorithm:", EDIT_ALGS, on_change=reset)
|
42 |
|
43 |
st.write("Edits applied so far:")
|
44 |
st.table(edits)
|
|
|
1 |
from turtle import onclick
|
2 |
import streamlit as st
|
3 |
import pandas as pd
|
4 |
+
import time
|
5 |
|
6 |
EDIT_ALGS = [
|
7 |
+
"MEND: Model editor networks using gradient decomposition",
|
8 |
+
"SERAC: Semi-parametric editing with a retrieval-augmented counterfactual model",
|
9 |
+
"ENN: Editable neural networks",
|
10 |
+
"KE: KnowledgeEditor",
|
11 |
"Fine-tuning",
|
12 |
"Lookup Cache"
|
13 |
]
|
14 |
|
15 |
+
st.title("Language Model Editing")
|
16 |
+
st.write("Choose an editing algorithm, apply some edits, and sample from the model to see how its behavior changes. You can sample the model at any time to see the \"before and after\" of the edits you apply.")
|
17 |
+
st.markdown("***")
|
18 |
|
19 |
# https://discuss.streamlit.io/t/simple-example-of-persistence-and-waiting-for-input/2111
|
20 |
@st.cache(allow_output_mutation=True)
|
|
|
31 |
def reset():
|
32 |
edits.drop(edits.index, inplace=True)
|
33 |
model_outputs.drop(edits.index, inplace=True)
|
34 |
+
|
35 |
+
selected_alg = st.session_state.alg_selector
|
36 |
+
selected_alg_idx = EDIT_ALGS.index(selected_alg)
|
37 |
+
|
38 |
############# Need to reset the model here (and maybe show progress spinner?)
|
39 |
|
40 |
def apply_edit():
|
|
|
43 |
def sample_model():
|
44 |
model_outputs.loc[len(model_outputs)] = [str(test_input), "blah blah blah", len(edits)]
|
45 |
|
46 |
+
alg_selector = st.selectbox("Editing algorithm:", EDIT_ALGS, key="alg_selector", on_change=reset)
|
47 |
|
48 |
st.write("Edits applied so far:")
|
49 |
st.table(edits)
|