Skip to content

Commit

Permalink
Merge pull request karpathy#236 from ymurenko/master
Browse files Browse the repository at this point in the history
fix "cuda out of memory" when resuming training
  • Loading branch information
karpathy authored Apr 13, 2023
2 parents 553f949 + 4ac2e8c commit 2457471
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def get_batch(split):
optimizer = model.configure_optimizers(weight_decay, learning_rate, (beta1, beta2), device_type)
if init_from == 'resume':
optimizer.load_state_dict(checkpoint['optimizer'])
checkpoint = None # free up memory

# compile the model
if compile:
Expand Down

0 comments on commit 2457471

Please sign in to comment.