support for loading on cpu first when using DDP
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.5k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 3
Description
in this example:
# Restore
model = ...
optimizer = ...
checkpoint = torch.load('amp_checkpoint.pt')
model, optimizer = amp.initialize(model, optimizer, opt_level=opt_level)
model.load_state_dict(checkpoint['model'])
optimizer.load_state_dict(checkpoint['optimizer'])
amp.load_state_dict(checkpoint['amp'])
# Continue training
...
one cannot load the model to CPU first before restoring weight. this is necessary as a way to not have OOM with RAM when using huge models.
The flow that needs support is:
model.load_state(... using_cpu)
model.cuda(x)
model = amp.initialize(...)
model = DDP(model)
Contributor guide
No contributing guide indexed for this repository
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
Start with the checkpoint restore flow using torch.load, load_state_dict, amp.initialize, and DDP as shown in the issue, then trace how model state is loaded and moved to CUDA. Done means the model can load weights on CPU first, move to CUDA, initialize AMP, and wrap with DDP without requiring excessive RAM.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- distributed-systems, machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100