COCOCO icon indicating copy to clipboard operation
COCOCO copied to clipboard

ValueError: cross_attention_dim must be specified for CrossAttnDownBlock2D

Open LKY-coder opened this issue 1 year ago • 7 comments

When I load stable-diffusion-v1-5-inpainting, the following error is reported. How can I solve it?

Traceback (most recent call last):
  File "/root/paddlejob/workspace/likaiyun/COCOCO/app.py", line 37, in <module>
    validation_pipeline = load_model(model_path=args.model_path, \
  File "/root/paddlejob/workspace/likaiyun/COCOCO/utils.py", line 63, in load_model
    vae            = AutoencoderKL.from_pretrained(pretrained_model_path, subfolder="vae")
  File "/root/anaconda3/envs/cococo/lib/python3.10/site-packages/diffusers/modeling_utils.py", line 483, in from_pretrained
    model = cls.from_config(config, **unused_kwargs)
  File "/root/anaconda3/envs/cococo/lib/python3.10/site-packages/diffusers/configuration_utils.py", line 210, in from_config
    model = cls(**init_dict)
  File "/root/anaconda3/envs/cococo/lib/python3.10/site-packages/diffusers/configuration_utils.py", line 567, in inner_init
    init(self, *args, **init_kwargs)
  File "/root/anaconda3/envs/cococo/lib/python3.10/site-packages/diffusers/models/vae.py", line 539, in __init__
    self.encoder = Encoder(
  File "/root/anaconda3/envs/cococo/lib/python3.10/site-packages/diffusers/models/vae.py", line 94, in __init__
    down_block = get_down_block(
  File "/root/anaconda3/envs/cococo/lib/python3.10/site-packages/diffusers/models/unet_2d_blocks.py", line 83, in get_down_block
    raise ValueError("cross_attention_dim must be specified for CrossAttnDownBlock2D")
ValueError: cross_attention_dim must be specified for CrossAttnDownBlock2D

LKY-coder avatar Nov 03 '24 12:11 LKY-coder

same issue

vfan26 avatar Nov 15 '24 09:11 vfan26

I encountered the same problem, have you solved it?

solarlemon avatar Dec 01 '24 13:12 solarlemon

@solarlemon Hi how did you run the code, I'm trying to set up the environment on colab but am having issues

muratali016 avatar Dec 02 '24 00:12 muratali016

same issue

Weiwenliang123 avatar Dec 06 '24 13:12 Weiwenliang123

@solarlemon Hi how did you run the code, I'm trying to set up the environment on colab but am having issues

local machine

solarlemon avatar Dec 08 '24 08:12 solarlemon

I managed to move pass the vae error by deleting the config.json under the stable diffusion inpainting directory (e.g. ./stable-diffusion-v1-5-inpainting/config.json) following the comments on this diffuser issue (assuming you're downloading the one provided in the readme). Hope this helps.

jefflao avatar Dec 23 '24 04:12 jefflao

I managed to move pass the vae error by deleting the config.json under the stable diffusion inpainting directory (e.g. ./stable-diffusion-v1-5-inpainting/config.json) following the comments on this diffuser issue (assuming you're downloading the one provided in the readme). Hope this helps.

Thanks, it helps me a lot.

Shuyun-Wang avatar May 15 '25 18:05 Shuyun-Wang