dar-tau commited on
Commit
a5aded9
·
verified ·
1 Parent(s): 7889ca8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -142,7 +142,7 @@ def run_interpretation(raw_original_prompt, raw_interpretation_prompt, max_new_t
142
  # diff_score = F.normalize(vectors_to_compare, dim=-1).diff(dim=0).norm(dim=-1)
143
  bags_of_words = [set(tokenizer.tokenize(text)) for text in generation_texts]
144
  diff_score = torch.tensor([
145
- len(bags_of_words[i+1] & bags_of_words[i]) / np.sqrt(len(bags_of_words[i+1]) * len(bags_of_words[i]))
146
  for i in range(len(bags_of_words)-1)
147
  ])
148
  avoid_first, avoid_last = 2, 1 # layers that are usually never important
 
142
  # diff_score = F.normalize(vectors_to_compare, dim=-1).diff(dim=0).norm(dim=-1)
143
  bags_of_words = [set(tokenizer.tokenize(text)) for text in generation_texts]
144
  diff_score = torch.tensor([
145
+ -len(bags_of_words[i+1] & bags_of_words[i]) / np.sqrt(len(bags_of_words[i+1]) * len(bags_of_words[i]))
146
  for i in range(len(bags_of_words)-1)
147
  ])
148
  avoid_first, avoid_last = 2, 1 # layers that are usually never important