Spaces:
Running
on
Zero
Running
on
Zero
wondervictor
commited on
Update autoregressive/models/generate.py
Browse files
autoregressive/models/generate.py
CHANGED
@@ -60,9 +60,9 @@ def sample(logits, temperature: float=1.0, top_k: int=2000, top_p: float=1.0, sa
|
|
60 |
logits = logits[:, -1, :] / max(temperature, 1e-5)
|
61 |
if top_k > 0 or top_p < 1.0:
|
62 |
logits = top_k_top_p_filtering(logits, top_k=top_k, top_p=top_p)
|
|
|
|
|
63 |
probs = F.softmax(logits, dim=-1)
|
64 |
-
print(probs.sum())
|
65 |
-
print(probs)
|
66 |
# values, indices = torch.max(probs, dim=1, keepdim=True)
|
67 |
# mask = (probs == values).float()
|
68 |
# probs = probs * (1 - mask)
|
|
|
60 |
logits = logits[:, -1, :] / max(temperature, 1e-5)
|
61 |
if top_k > 0 or top_p < 1.0:
|
62 |
logits = top_k_top_p_filtering(logits, top_k=top_k, top_p=top_p)
|
63 |
+
print(logits.sum())
|
64 |
+
print(logits)
|
65 |
probs = F.softmax(logits, dim=-1)
|
|
|
|
|
66 |
# values, indices = torch.max(probs, dim=1, keepdim=True)
|
67 |
# mask = (probs == values).float()
|
68 |
# probs = probs * (1 - mask)
|