Lightning-AI / Lightning-AI/litgpt
GPU memory calculator
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13.7k
- Forks
- 1.5k
- Avg merge
- 15h 37m
- Merged PRs (30d)
- 1
Description
When scaling models to multiple GPUs, it can be difficult to estimate the memory requirement in advance, especially since it is a function of:
- batch size
- optimizer type
- precision settings
- number of parameters
- model architecture / hyperparameters
- FSDP settings
- and more
We could provide a simple calculator tool that given a model config from lit-gpt, and a set of the parameters listed above, can compute the per GPU memory requirement or at least a rough estimation. Given that, the user would then be able to choose the appropriate machine type, number of GPUs, machines etc. to launch their job.
The memory usage is composed of:
- parameters
- activations
- gradients
- optimizer states
We need to compute these and sum them up to give the total estimated memory usage.
cc @lantiga @carmocca @rasbt
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points, so first locate the model configuration and FSDP-related code in litgpt. Clarify the calculator's inputs, estimation formulas, and supported configurations before implementation; done should include estimates for parameters, activations, gradients, and optimizer states per GPU.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100