From d708b1e5e292473430e5d074d42d0c8990a3373a Mon Sep 17 00:00:00 2001 From: Andrej Karpathy Date: Tue, 18 Aug 2020 17:05:59 -0700 Subject: [PATCH] fix a dumb bug, intended to use -1e10 instead of 1e-10. thank you @fpgaminer for spotting and bringing to my attention --- mingpt/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingpt/utils.py b/mingpt/utils.py index e1bde28..fb38c92 100644 --- a/mingpt/utils.py +++ b/mingpt/utils.py @@ -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()