From 50617fa75dfb6bd57ea342c47ddcafecdc03e9e3 Mon Sep 17 00:00:00 2001 From: Andrej Karpathy Date: Sat, 20 Aug 2022 01:29:27 +0000 Subject: [PATCH] fix comment --- makemore.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makemore.py b/makemore.py index 170880a..75efc08 100644 --- a/makemore.py +++ b/makemore.py @@ -389,10 +389,12 @@ def next(self): # feed into the model logits, loss = model(X, Y) - # calculate the gradient, clip it, update the weights + # calculate the gradient, update the weights model.zero_grad(set_to_none=True) loss.backward() optimizer.step() + + # wait for all CUDA work on the GPU to finish then calculate iteration time taken if args.device.startswith('cuda'): torch.cuda.synchronize() t1 = time.time()