dar-tau commited on
Commit
f724621
1 Parent(s): 0846fd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -146,7 +146,8 @@ def run_interpretation(raw_original_prompt, raw_interpretation_prompt, max_new_t
146
  -len(bags_of_words[i+1] & bags_of_words[i]) / np.sqrt(len(bags_of_words[i+1]) * len(bags_of_words[i]))
147
  for i in range(len(bags_of_words)-1)
148
  ])
149
- diff_score = diff_score1 / diff_score1.max() + diff_score2 / diff_score2.max()
 
150
 
151
  avoid_first, avoid_last = 2, 1 # layers that are usually never important
152
  assert avoid_first >= 1 # due to .diff() we will not be able to compute a score for the first layer
@@ -222,7 +223,8 @@ with gr.Blocks(theme=gr.themes.Default(), css='styles.css') as demo:
222
  with gr.Group():
223
  raw_original_prompt.render()
224
  original_prompt_btn = gr.Button('Output Token List', variant='primary')
225
-
 
226
  gr.Markdown('## Choose Your Interpretation Prompt')
227
  with gr.Group('Interpretation'):
228
  raw_interpretation_prompt = gr.Text(suggested_interpretation_prompts[0], label='Interpretation Prompt')
 
146
  -len(bags_of_words[i+1] & bags_of_words[i]) / np.sqrt(len(bags_of_words[i+1]) * len(bags_of_words[i]))
147
  for i in range(len(bags_of_words)-1)
148
  ])
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 = 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
 
223
  with gr.Group():
224
  raw_original_prompt.render()
225
  original_prompt_btn = gr.Button('Output Token List', variant='primary')
226
+ gr.Markdown('**Tokens will appear in the "Tokens" section**')
227
+
228
  gr.Markdown('## Choose Your Interpretation Prompt')
229
  with gr.Group('Interpretation'):
230
  raw_interpretation_prompt = gr.Text(suggested_interpretation_prompts[0], label='Interpretation Prompt')