Skip to content

Commit

Permalink
slight tweak compressing LOC
Browse files Browse the repository at this point in the history
  • Loading branch information
karpathy committed Feb 4, 2023
1 parent 53d56b8 commit b3c17c6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,10 @@ def get_lr(it):
t0 = time.time()
while True:

# determine the learning rate for this iteration
if decay_lr:
lr = get_lr(iter_num)
for param_group in optimizer.param_groups:
param_group['lr'] = lr
else:
lr = learning_rate
# determine and set the learning rate for this iteration
lr = get_lr(iter_num) if decay_lr else learning_rate
for param_group in optimizer.param_groups:
param_group['lr'] = lr

# evaluate the loss on train/val sets and write checkpoints
if iter_num % eval_interval == 0 and master_process:
Expand Down

0 comments on commit b3c17c6

Please sign in to comment.