deepspeedai / deepspeedai/DeepSpeed

[REQUEST] How to use deepspeed.checkpointing.non_reentrant_checkpoint() properly with Stage3?

Open
#4,595 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

See https://github.com/microsoft/DeepSpeed/issues/4332.

After diffusers 0.17.0, non-reentrant variant of torch.utils.checkpoint.checkpoint becomes default but is incompatible with Deepspeed Stage3.

I found https://github.com/microsoft/DeepSpeed/pull/4118, then replaced torch.utils.checkpoint.checkpoint with deepspeed.checkpointing.non_reentrant_checkpoint before import diffusers but still met an error said "RuntimeError: The size of tensor a (0) must match the size of tensor b (1280) at non-singleton dimension 1".

Maybe I use non_reentrant_checkpoint improperly. Any suggestions for me to make non-reentrant checkpoint compatible with stage3?

cc @hughpu

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 by reading issues 4332 and 4595, then compare DeepSpeed PR 4118 with the diffusers 0.17.0 checkpoint behavior. Reproduce the reported tensor-size error with Stage3 and trace the use of deepspeed.checkpointing.non_reentrant_checkpoint; done means documenting or implementing a confirmed compatible usage path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.