taka-yamakoshi
commited on
Commit
·
4dc3080
1
Parent(s):
0b05f1f
build again
Browse files
app.py
CHANGED
@@ -237,7 +237,6 @@ if __name__=='__main__':
|
|
237 |
for token_ids in [masked_ids_option_1['sent_1'],masked_ids_option_1['sent_2'],masked_ids_option_2['sent_1'],masked_ids_option_2['sent_2']]:
|
238 |
st.write(' '.join([tokenizer.decode([token]) for token in token_ids]))
|
239 |
|
240 |
-
if st.session_state['page_status'] == 'finish_debug':
|
241 |
option_1_tokens_1 = np.array(input_ids_dict['sent_1'])[np.array(option_1_locs['sent_1'])+1]
|
242 |
option_1_tokens_2 = np.array(input_ids_dict['sent_2'])[np.array(option_1_locs['sent_2'])+1]
|
243 |
option_2_tokens_1 = np.array(input_ids_dict['sent_1'])[np.array(option_2_locs['sent_1'])+1]
|
@@ -250,6 +249,7 @@ if __name__=='__main__':
|
|
250 |
probs_original = run_intervention(interventions,1,model,masked_ids_option_1,masked_ids_option_2,option_1_tokens,option_2_tokens,pron_locs)
|
251 |
st.write(probs_original)
|
252 |
|
|
|
253 |
for layer_id in range(num_layers):
|
254 |
interventions = [create_interventions(16,['lay','qry','key','val'],num_heads) if i==layer_id else {'lay':[],'qry':[],'key':[],'val':[]} for i in range(num_layers)]
|
255 |
probs = run_intervention(interventions,num_heads,model,masked_ids_option_1,masked_ids_option_2,option_1_tokens,option_2_tokens,pron_locs)
|
|
|
237 |
for token_ids in [masked_ids_option_1['sent_1'],masked_ids_option_1['sent_2'],masked_ids_option_2['sent_1'],masked_ids_option_2['sent_2']]:
|
238 |
st.write(' '.join([tokenizer.decode([token]) for token in token_ids]))
|
239 |
|
|
|
240 |
option_1_tokens_1 = np.array(input_ids_dict['sent_1'])[np.array(option_1_locs['sent_1'])+1]
|
241 |
option_1_tokens_2 = np.array(input_ids_dict['sent_2'])[np.array(option_1_locs['sent_2'])+1]
|
242 |
option_2_tokens_1 = np.array(input_ids_dict['sent_1'])[np.array(option_2_locs['sent_1'])+1]
|
|
|
249 |
probs_original = run_intervention(interventions,1,model,masked_ids_option_1,masked_ids_option_2,option_1_tokens,option_2_tokens,pron_locs)
|
250 |
st.write(probs_original)
|
251 |
|
252 |
+
if st.session_state['page_status'] == 'finish_debug':
|
253 |
for layer_id in range(num_layers):
|
254 |
interventions = [create_interventions(16,['lay','qry','key','val'],num_heads) if i==layer_id else {'lay':[],'qry':[],'key':[],'val':[]} for i in range(num_layers)]
|
255 |
probs = run_intervention(interventions,num_heads,model,masked_ids_option_1,masked_ids_option_2,option_1_tokens,option_2_tokens,pron_locs)
|