Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,7 +55,7 @@ def run_lens(model,PROMPT):
|
|
| 55 |
logits_lens_token_result_by_layer.append(logits_lens_next_token)
|
| 56 |
tokens_out = llama.lm_head.output.argmax(dim=-1).save()
|
| 57 |
expected_token = tokens_out[0][-1].save()
|
| 58 |
-
logits_lens_all_probs = np.concatenate([probs[:, expected_token].cpu().detach().numpy() for probs in logits_lens_probs_by_layer])
|
| 59 |
#get the rank of the expected token from each layer's distribution
|
| 60 |
for layer_probs in logits_lens_probs_by_layer:
|
| 61 |
# Sort the probabilities in descending order and find the rank of the expected token
|
|
|
|
| 55 |
logits_lens_token_result_by_layer.append(logits_lens_next_token)
|
| 56 |
tokens_out = llama.lm_head.output.argmax(dim=-1).save()
|
| 57 |
expected_token = tokens_out[0][-1].save()
|
| 58 |
+
logits_lens_all_probs = np.concatenate([probs[:, expected_token].cpu().detach().to(torch.float32).numpy() for probs in logits_lens_probs_by_layer])
|
| 59 |
#get the rank of the expected token from each layer's distribution
|
| 60 |
for layer_probs in logits_lens_probs_by_layer:
|
| 61 |
# Sort the probabilities in descending order and find the rank of the expected token
|