Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero-grad more aggressively to save memory #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cchan
Copy link

@cchan cchan commented Jan 18, 2023

Takes a full copy of grad off the peak memory usage.

Numbers based on torch.cuda.max_memory_allocated():

  • For gpt-nano: 32019456 to 31666688
  • For gpt2-xl: 30634800640 to 24607903232 (6 gigabytes!)

@karpathy
Copy link
Owner

:O ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants