Lightning-AI / Lightning-AI/pytorch-lightning
Lightning Fabric: generic method to get the full state dict
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
### Description & Motivation
Hi,
I would like a generic method of getting the full state dict on rank 0 for a lightning fabric wrapped module. Base lightning seems to have lightning_module_state_dict, but fabric only has save_checkpoint (which for my usecase doesn't work, as I do not want to save the entire state to a single file).
### Pitch
See above.
### Alternatives
None.
### Additional context
_No response_
cc @lantiga @borda @justusschock
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
Start by comparing Lightning Fabric's existing save_checkpoint behavior with Base Lightning's lightning_module_state_dict method. Trace how a Fabric-wrapped module exposes state across ranks and determine the expected rank-0 result without writing the full state to one file. Done means a generic, documented method is available for retrieving the full state dict and its behavior is covered by appropriate tests.
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