Update app.py
Browse files
app.py
CHANGED
@@ -149,10 +149,10 @@ def run_interpretation(raw_original_prompt, raw_interpretation_prompt, max_new_t
|
|
149 |
diff_score = ((diff_score1 - diff_score1.min()) / (diff_score1.max() - diff_score1.min())
|
150 |
+ (diff_score2 - diff_score2.min()) / (diff_score2.max() - diff_score2.min()))
|
151 |
|
152 |
-
avoid_first, avoid_last =
|
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=}')
|
|
|
149 |
diff_score = ((diff_score1 - diff_score1.min()) / (diff_score1.max() - diff_score1.min())
|
150 |
+ (diff_score2 - diff_score2.min()) / (diff_score2.max() - diff_score2.min()))
|
151 |
|
152 |
+
avoid_first, avoid_last = 3, 3 # 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=int(np.ceil(0.3 * len(diff_score)))).indices.cpu().numpy() #
|
156 |
|
157 |
# create GUI output
|
158 |
print(f'{important_idxs=}')
|