custom-diffusion icon indicating copy to clipboard operation
custom-diffusion copied to clipboard

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

Open xiaqingsun opened this issue 2 years ago • 4 comments

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

xiaqingsun avatar Feb 01 '23 12:02 xiaqingsun

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.

nupurkmr9 avatar Feb 01 '23 17:02 nupurkmr9

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

xiaqingsun avatar Feb 08 '23 02:02 xiaqingsun

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

wangzhaolei avatar Mar 17 '23 02:03 wangzhaolei

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

yannqi avatar Dec 27 '23 11:12 yannqi