johannakarras / DreamPose

Official implementation of "DreamPose: Fashion Image-to-Video Synthesis via Stable Diffusion"
MIT License
955 stars 74 forks source link

Colab problem: The expanded size of the tensor (10) must match the existing size (11) at a non-singleton dimension 1. #65

Open steinhaug opened 6 months ago

steinhaug commented 6 months ago

I put up a quick colab hoping for this to work, but when running the demo I get an error:

Here is the Colab.

Running the test.py --epoch...

unet/config.json: 100% 743/743 [00:00<00:00, 2.91MB/s] diffusion_pytorch_model.safetensors: 100% 3.44G/3.44G [00:34<00:00, 99.9MB/s] Traceback (most recent call last): File "/content/DreamPose/test.py", line 48, in <module> unet = get_unet('CompVis/stable-diffusion-v1-4', "ebb811dd71cdc38a204ecbdd6ac5d580f529fd8c", resolution=512) File "/content/DreamPose/models/unet_dual_encoder.py", line 30, in get_unet unet.conv_in.weight[:, 4:] = torch.zeros(unet.conv_in.weight[:, 3:].shape) # new weights initialized to zero

RuntimeError: The expanded size of the tensor (10) must match the existing size (11) at non-singleton dimension 1. Target sizes: [320, 10, 3, 3]. Tensor sizes: [320, 11, 3, 3]

xhqi0109 commented 6 months ago

+1

isabellapu commented 6 months ago

+1

SaharaSheik commented 5 months ago

I solved this by making the following changes to in this file models/unet_dual_encoder.py line 30 https://github.com/johannakarras/DreamPose/blob/5bf30b7df70cf6f2e0bb25556c6ff2cbf0f2b1bf/models/unet_dual_encoder.py#L30C1-L30C117

        unet.conv_in.weight[:, 4:] = torch.zeros(unet.conv_in.weight[:, 3:].shape) # new weights initialized to zero

change to

        unet.conv_in.weight[:, 4:] = torch.zeros(unet.conv_in.weight[:, 4:].shape) # new weights initialized to zero