Lightning-AI / Lightning-AI/pytorch-lightning
FSDP hybrid shard should checkpoint in a single node
@awaelchli is already working on this.
Since Feb 20, 2024.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
### Description & Motivation
https://github.com/pytorch/pytorch/pull/104810 adds the recommendation that the `save` APIs should be called in a single node (`shard_group`).
https://github.com/pytorch/pytorch/issues/102904#issuecomment-1862892480 Also talks about this
Our logic doesn't do this and runs this code in all ranks.
### Additional context
Lit-gpt uses hybrid sharding in `pretrain/tinyllama.py` but full checkpointing. I believe this feature request is only relevant for sharded pointing. @awaelchli Did you try it? Does sharded hybrid checkpointing work?
cc @borda @awaelchli @carmocca
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.
Assessment
This issue has not been assessed yet.