1
0
Fork 0
mirror of https://github.com/karpathy/minGPT synced 2024-05-22 15:36:09 +02:00

fix a dumb bug, intended to use -1e10 instead of 1e-10. thank you @fpgaminer for spotting and bringing to my attention

This commit is contained in:
Andrej Karpathy 2020-08-18 17:05:59 -07:00
parent 0d9d098cd2
commit d708b1e5e2

View File

@ -13,7 +13,7 @@ def set_seed(seed):
def top_k_logits(logits, k):
v, ix = torch.topk(logits, k)
out = logits.clone()
out[out < v[:, [-1]]] = 1e-10
out[out < v[:, [-1]]] = -float('Inf')
return out
@torch.no_grad()