WindVChen / DiffAttack

An unrestricted attack based on diffusion models that can achieve both good transferability and imperceptibility.
Apache License 2.0
114 stars 9 forks source link

KeyError: 'up_cross' #2

Open tanlingp opened 1 year ago

tanlingp commented 1 year ago

Sorry to interrupt, code error Traceback (most recent call last). File "main.py", line 153, in adv_image, clean_acc, adv_acc = run_diffusion_attack(tmp_image, label[ind:ind + 1]. File "main.py", line 72, in run_diffusion_attack adv_image, clean_acc, adv_acc = diff_latent_attack.diffattack(diffusion_model, label, controller. File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/202221623173/DiffAttack-main/diff_latent_attack.py", line 369, in diffattack before_attention_map = aggregate_attention(prompt, controller, 7, ("up", "down"), True, 0, is_cpu=False) File "/202221623173/DiffAttack-main/utils.py", line 13, in aggregate_attention for item in attentionmaps[f"{location}{'cross' if is_cross else 'self'}"]. KeyError: 'up_cross'

WindVChen commented 1 year ago

Hi @tanlingp ,

Based on the above information, I am currently unable to conclude what is causing this error. Can you take a look at your diffusers version? It might be due to the version inconsistency.

tanlingp commented 1 year ago

Thank you very much for your help, it is indeed the reason for the wrong version

kikyou-220 commented 11 months ago

Sorry to interrupt, I'm having this problem too, can I ask which version are you using?

tanlingp commented 11 months ago

The version given by the author

nil0330 commented 8 months ago

The version given by the author

The version given by the author

I have the same question, and I'm unsure which specific version we need. Could you please assist me in clarifying this?

WindVChen commented 8 months ago

Hi @nil0330 ,

You can take a look at requirements.txt for the versions of some packages.

Hope this helps.