Update app.py
Browse files
app.py
CHANGED
@@ -142,7 +142,7 @@ def run_interpretation(raw_original_prompt, raw_interpretation_prompt, max_new_t
|
|
142 |
avoid_first, avoid_last = 2, 1 # layers that are usually never important
|
143 |
vectors_to_compare = vectors_to_compare[avoid_first:-avoid_last]
|
144 |
diff_score = F.normalize(vectors_to_compare, dim=-1).diff(dim=0).norm(dim=-1)
|
145 |
-
important_idxs =
|
146 |
|
147 |
# create GUI output
|
148 |
print(f'{important_idxs=}')
|
|
|
142 |
avoid_first, avoid_last = 2, 1 # layers that are usually never important
|
143 |
vectors_to_compare = vectors_to_compare[avoid_first:-avoid_last]
|
144 |
diff_score = F.normalize(vectors_to_compare, dim=-1).diff(dim=0).norm(dim=-1)
|
145 |
+
important_idxs = avoid_first + diff_score.topk(k=int(np.ceil(0.1 * len(generation_texts)))).indices.cpu().numpy()
|
146 |
|
147 |
# create GUI output
|
148 |
print(f'{important_idxs=}')
|