Lightning-AI / Lightning-AI/pytorch-lightning

FSDP hybrid shard should checkpoint in a single node

Open
#19,494 4 comments 1 reaction 1 assignee View on GitHub

@awaelchli is already working on this.

Since Feb 20, 2024.

checkpointing feature strategy: fsdp
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.