dar-tau commited on
Commit
03b5112
·
verified ·
1 Parent(s): af967c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -97,6 +97,7 @@ def get_hidden_states(raw_original_prompt, force_hidden_states=False):
97
  tokens = tokenizer.batch_decode(model_inputs.input_ids[0])
98
  if global_state.wait_with_hidden_states and not force_hidden_states:
99
  global_state.local_state.hidden_states = None
 
100
  else:
101
  outputs = model(**model_inputs, output_hidden_states=True, return_dict=True)
102
  hidden_states = torch.stack([h.squeeze(0).cpu().detach() for h in outputs.hidden_states], dim=0)
 
97
  tokens = tokenizer.batch_decode(model_inputs.input_ids[0])
98
  if global_state.wait_with_hidden_states and not force_hidden_states:
99
  global_state.local_state.hidden_states = None
100
+ important_tokens = [] # cannot find important tokens without the hidden states
101
  else:
102
  outputs = model(**model_inputs, output_hidden_states=True, return_dict=True)
103
  hidden_states = torch.stack([h.squeeze(0).cpu().detach() for h in outputs.hidden_states], dim=0)