Update app.py
Browse files
app.py
CHANGED
|
@@ -152,7 +152,7 @@ def run_interpretation(raw_original_prompt, raw_interpretation_prompt, max_new_t
|
|
| 152 |
avoid_first, avoid_last = 2, 1 # layers that are usually never important
|
| 153 |
assert avoid_first >= 1 # due to .diff() we will not be able to compute a score for the first layer
|
| 154 |
diff_score = diff_score[avoid_first-1:len(diff_score)-avoid_last]
|
| 155 |
-
important_idxs = avoid_first + diff_score.topk(k=
|
| 156 |
|
| 157 |
# create GUI output
|
| 158 |
print(f'{important_idxs=}')
|
|
@@ -179,7 +179,7 @@ for i in range(MAX_PROMPT_TOKENS):
|
|
| 179 |
btn = gr.Button('', visible=False, elem_classes=['token_btn'])
|
| 180 |
tokens_container.append(btn)
|
| 181 |
|
| 182 |
-
with gr.Blocks(theme=gr.themes.
|
| 183 |
with gr.Row():
|
| 184 |
with gr.Column(scale=5):
|
| 185 |
gr.Markdown('# 😎 Self-Interpreting Models')
|
|
|
|
| 152 |
avoid_first, avoid_last = 2, 1 # layers that are usually never important
|
| 153 |
assert avoid_first >= 1 # due to .diff() we will not be able to compute a score for the first layer
|
| 154 |
diff_score = diff_score[avoid_first-1:len(diff_score)-avoid_last]
|
| 155 |
+
important_idxs = avoid_first + diff_score.topk(k=7).indices.cpu().numpy() # k=int(np.ceil(0.15 * len(generation_texts)))
|
| 156 |
|
| 157 |
# create GUI output
|
| 158 |
print(f'{important_idxs=}')
|
|
|
|
| 179 |
btn = gr.Button('', visible=False, elem_classes=['token_btn'])
|
| 180 |
tokens_container.append(btn)
|
| 181 |
|
| 182 |
+
with gr.Blocks(theme=gr.themes.Glass(), css='styles.css') as demo:
|
| 183 |
with gr.Row():
|
| 184 |
with gr.Column(scale=5):
|
| 185 |
gr.Markdown('# 😎 Self-Interpreting Models')
|