cplusx / layout_diffuse

Code release for LayoutDiffuse
47 stars 6 forks source link

Got keyerror in sampling #5

Closed bbzhu-jy16 closed 1 year ago

bbzhu-jy16 commented 1 year ago

I split the models and run the sampling command but got keyerror as below:

python sampling.py -c configs/cocostuff_SD2_1.json --model_path /path/cocostuff_ldm.ckpt

Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels INFO: initialize denoising UNet from pretrained_models/SD2_1/unet.ckpt, NOTE: without partial attention layers Traceback (most recent call last): File "sampling.py", line 43, in ddpm_model = get_DDPM( File "/space0/zhujingyuan/layout_diffuse-main/train_utils.py", line 44, in get_DDPM ddpm_model = DDPM_model( File "/space0/zhujingyuan/layout_diffuse-main/DDIM_ldm/DDIM_ldm.py", line 555, in init super().init( File "/space0/zhujingyuan/layout_diffuse-main/DDIM_ldm/DDIM_ldm.py", line 430, in init self.initialize_unet(unet_init_weights) File "/space0/zhujingyuan/layout_diffuse-main/DDIM_ldm/DDIM_ldm_coco.py", line 103, in initialize_unet self_model_sd[this_k] = model_sd[key_in_foundational_model] KeyError: 'output_blocks.5.2.conv.weight'

How to solve this problem?

cplusx commented 1 year ago

Hi, you can skip this part of code. The function initialize_unet is used to give a start training weight for finetuning. If you only need to use sampling, you can skip this function (e.g., comment the function and use "pass").

In short, you do not need it for sampling, it is only required for trianing

bbzhu-jy16 commented 1 year ago

Thank you. I have solved the problem by fixing the code in split_model.py.