Lightning-AI / Lightning-AI/pytorch-lightning

FSDP checkpointing uses deprecated APIs with PyTorch 2.2

Open
#19,462 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug checkpointing strategy: fsdp
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

### Bug description

See added deprecation warnings in https://github.com/pytorch/pytorch/pull/113867

### What version are you seeing the problem on?

v2.2

### How to reproduce the bug

Originated from

https://github.com/Lightning-AI/pytorch-lightning/blob/b097a4df3f3fa8b4465861ccab17a44a8ae1ebb9/src/lightning/fabric/strategies/fsdp.py#L496

We already use the newer API for loading

https://github.com/Lightning-AI/pytorch-lightning/blob/b097a4df3f3fa8b4465861ccab17a44a8ae1ebb9/src/lightning/fabric/strategies/fsdp.py#L563-L566

### Error messages and logs

```
/home/carlos/nightly-env/lib/python3.10/site-packages/torch/distributed/checkpoint/state_dict_saver.py:31: UserWarning: 'save_state_dict' is deprecated and will be removed in future versions.Please use 'save' instead.
warnings.warn(
```

### Environment

_No response_

### More info

_No response_

cc @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.

Research direction

Start in src/lightning/fabric/strategies/fsdp.py around line 496 and compare the saving path with the newer loading API around lines 563-566. Update the deprecated checkpointing usage indicated by the warning, then verify FSDP checkpoint saving no longer emits the deprecation warning under PyTorch 2.2.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.