Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ def initialize_gpu():
|
|
46 |
def get_hidden_states(raw_original_prompt):
|
47 |
original_prompt = original_prompt_template.format(prompt=raw_original_prompt)
|
48 |
model_inputs = tokenizer(original_prompt, add_special_tokens=False, return_tensors="pt").to(model.device)
|
49 |
-
tokens = tokenizer.batch_decode(model_inputs.input_ids)
|
50 |
outputs = model(**model_inputs, output_hidden_states=True, return_dict=True)
|
51 |
hidden_states = torch.stack([h.squeeze(0).cpu().detach() for h in outputs.hidden_states], dim=0)
|
52 |
# with gr.Row() as tokens_container:
|
|
|
46 |
def get_hidden_states(raw_original_prompt):
|
47 |
original_prompt = original_prompt_template.format(prompt=raw_original_prompt)
|
48 |
model_inputs = tokenizer(original_prompt, add_special_tokens=False, return_tensors="pt").to(model.device)
|
49 |
+
tokens = tokenizer.batch_decode(model_inputs.input_ids[0])
|
50 |
outputs = model(**model_inputs, output_hidden_states=True, return_dict=True)
|
51 |
hidden_states = torch.stack([h.squeeze(0).cpu().detach() for h in outputs.hidden_states], dim=0)
|
52 |
# with gr.Row() as tokens_container:
|