Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,7 +68,7 @@ def analyze_next_token(input_text, temperature, top_p, top_k):
|
|
| 68 |
probabilities = torch.nn.functional.softmax(last_token_logits, dim=-1)
|
| 69 |
top_k = 10
|
| 70 |
top_probs, top_indices = torch.topk(probabilities, top_k)
|
| 71 |
-
top_words = [tokenizer.decode(
|
| 72 |
prob_data = {word: prob.item() for word, prob in zip(top_words, top_probs)}
|
| 73 |
prob_plot = plot_probabilities(prob_data)
|
| 74 |
|
|
|
|
| 68 |
probabilities = torch.nn.functional.softmax(last_token_logits, dim=-1)
|
| 69 |
top_k = 10
|
| 70 |
top_probs, top_indices = torch.topk(probabilities, top_k)
|
| 71 |
+
top_words = [tokenizer.decode(idx.item()).strip() for idx in top_indices]
|
| 72 |
prob_data = {word: prob.item() for word, prob in zip(top_words, top_probs)}
|
| 73 |
prob_plot = plot_probabilities(prob_data)
|
| 74 |
|