adobe-research / custom-diffusion

Custom Diffusion: Multi-Concept Customization of Text-to-Image Diffusion (CVPR 2023)
https://www.cs.cmu.edu/~custom-diffusion
Other
1.84k stars 136 forks source link

AttributeError: 'CrossAttention' object has no attribute 'reshape_heads_to_batch_dim' #23

Open xiaqingsun opened 1 year ago

xiaqingsun commented 1 year ago

Has anyone encountered this problem “AttributeError: 'CrossAttention' object has no attribute 'reshape_heads_to_batch_dim' ”

nupurkmr9 commented 1 year ago

Hi, pip install diffuser==0.11 should solve the problem for now. I will update the code soon to support the new version of diffuser library.

Thanks.

xiaqingsun commented 1 year ago

Thanks for your answer, it worked with diffuser==0.11. The results I reproduced with the data in the paper are good

my input images: image

my result: image image

But I change other pictures, the result is worse(the sunglasses is not like my input sunglasses)

my input images: image

my result: image

My training parameters are as follows:(I use the pretrained_model: runwayml/stable-diffusion-v1-5)

!accelerate launch src/diffuser_training.py \ --pretrained_model_name_or_path=$MODEL_NAME \ --output_dir=$OUTPUT_DIR \ --concepts_list="/content/concepts_list.json" \ --with_prior_preservation --prior_loss_weight=1.0 \ --resolution=512 \ --train_batch_size=2 \ --learning_rate=1e-5 \ --lr_warmup_steps=0 \ --max_train_steps=500 \ --num_class_images=200 \ --scale_lr --hflip \ --modifier_token "\<whxm>+\<bkmj>"

My concept_list.json are as follows: image

Is there something wrong with my training process causing this poor result? Looking forward for your reply, thank you! @nupurkmr9

wangzhaolei commented 1 year ago

Are you missing an s after diffuser,that is pip install diffusers==0.11,

yannqi commented 8 months ago

Another feasible way, you can change 'reshape_heads_to_batch_dim' to 'head_to_batch_dim' According to https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py