Spaces:
Sleeping
Sleeping
Upload llm.py
Browse files- utils/llm.py +2 -1
utils/llm.py
CHANGED
@@ -105,7 +105,8 @@ NGワード:
|
|
105 |
next_token_logits = output.logits[0, -1, :]
|
106 |
next_token_probs = torch.softmax(next_token_logits, dim=-1)
|
107 |
sorted_ids = torch.argsort(next_token_probs, descending=True, dim=-1)
|
108 |
-
|
|
|
109 |
for i in range(2):
|
110 |
prob_d[tokenizer.decode(sorted_ids[i])] = next_token_probs[sorted_ids[i]].item()
|
111 |
|
|
|
105 |
next_token_logits = output.logits[0, -1, :]
|
106 |
next_token_probs = torch.softmax(next_token_logits, dim=-1)
|
107 |
sorted_ids = torch.argsort(next_token_probs, descending=True, dim=-1)
|
108 |
+
|
109 |
+
prob_d = {}
|
110 |
for i in range(2):
|
111 |
prob_d[tokenizer.decode(sorted_ids[i])] = next_token_probs[sorted_ids[i]].item()
|
112 |
|