Update app.py
Browse files
app.py
CHANGED
@@ -82,7 +82,7 @@ def run_interpretation(global_state, raw_interpretation_prompt, max_new_tokens,
|
|
82 |
# generate the interpretations
|
83 |
generated = interpretation_prompt.generate(model, {0: interpreted_vectors}, k=3, **generation_kwargs)
|
84 |
generation_texts = tokenizer.batch_decode(generated)
|
85 |
-
return [gr.Text(text, visible=True) for text in generation_texts]
|
86 |
|
87 |
|
88 |
## main
|
@@ -136,7 +136,7 @@ with gr.Blocks(theme=gr.themes.Default(), css=css) as demo:
|
|
136 |
with gr.Row():
|
137 |
with gr.Column(scale=5):
|
138 |
gr.Markdown('''
|
139 |
-
# π Self-Interpreting Models
|
140 |
|
141 |
πΎ **This space is a simple introduction to the emerging trend of models interpreting their _own hidden states_ in free form natural language**!! πΎ
|
142 |
This idea was explored in the paper **Patchscopes** ([Ghandeharioun et al., 2024](https://arxiv.org/abs/2401.06102)) and was later investigated further in **SelfIE** ([Chen et al., 2024](https://arxiv.org/abs/2403.10949)).
|
@@ -179,7 +179,7 @@ with gr.Blocks(theme=gr.themes.Default(), css=css) as demo:
|
|
179 |
tokens_container.append(btn)
|
180 |
|
181 |
for i in range(model.config.num_hidden_layers):
|
182 |
-
interpretation_bubbles.append(gr.Text('', visible=False,
|
183 |
|
184 |
for i, btn in enumerate(tokens_container):
|
185 |
btn.click(partial(run_interpretation, i=i), [global_state, interpretation_prompt, num_tokens, do_sample, temperature,
|
|
|
82 |
# generate the interpretations
|
83 |
generated = interpretation_prompt.generate(model, {0: interpreted_vectors}, k=3, **generation_kwargs)
|
84 |
generation_texts = tokenizer.batch_decode(generated)
|
85 |
+
return [gr.Text(text, visible=True, container=False) for text in generation_texts]
|
86 |
|
87 |
|
88 |
## main
|
|
|
136 |
with gr.Row():
|
137 |
with gr.Column(scale=5):
|
138 |
gr.Markdown('''
|
139 |
+
# π Self-Interpreting Models
|
140 |
|
141 |
πΎ **This space is a simple introduction to the emerging trend of models interpreting their _own hidden states_ in free form natural language**!! πΎ
|
142 |
This idea was explored in the paper **Patchscopes** ([Ghandeharioun et al., 2024](https://arxiv.org/abs/2401.06102)) and was later investigated further in **SelfIE** ([Chen et al., 2024](https://arxiv.org/abs/2403.10949)).
|
|
|
179 |
tokens_container.append(btn)
|
180 |
|
181 |
for i in range(model.config.num_hidden_layers):
|
182 |
+
interpretation_bubbles.append(gr.Text('', visible=False, elem_classes=['bubble']))
|
183 |
|
184 |
for i, btn in enumerate(tokens_container):
|
185 |
btn.click(partial(run_interpretation, i=i), [global_state, interpretation_prompt, num_tokens, do_sample, temperature,
|