deepspeedai / deepspeedai/DeepSpeed

[REQUEST] Wan2.1 support

Open
#7,142 0 comments 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

Is your feature request related to a problem? Please describe.
I'm trying to use wan2.1 with stage 3 but adding deepspeed.zero.Init() before WanModel.from_pretrained(self.model_config['ckpt_path'], torch_dtype=dtype) cause
NotImplementedError: Cannot copy out of meta tensor; no data!
Stacktrace points at:

self.patch_embedding = nn.Conv3d(in_dim, dim, kernel_size=patch_size, stride=patch_size)

in WanModel.init. I thinks it is because custom init_weights code in this init.

Describe the solution you'd like
Any way to fix it? Any suggestion how to modify the code for it to work?
I'm using diffusion-pipe implementation which doesn't use Trainer.

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 reproducing the failure around deepspeed.zero.Init() and WanModel.from_pretrained(...), then inspect the custom initialization in WanModel.init, especially the nn.Conv3d patch_embedding path. The work is done when Wan2.1 can load with stage 3 and the diffusion-pipe implementation without the meta-tensor NotImplementedError.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.