WindVChen / Diff-Harmonization

A novel zero-shot image harmonization method based on Diffusion Model Prior.
Apache License 2.0
110 stars 8 forks source link

I am getting KeyError: 'up_cross' #9

Open Rajesh1215 opened 1 month ago

Rajesh1215 commented 1 month ago

please help me solving this issue Optimize_text_embed: 0% 0/49 [00:00<?, ?it/s] Traceback (most recent call last): File "/content/Diff-Harmonization/main.py", line 306, in harmon_fun(composite_image, prompts, ldm_stable, diffusion_steps, guidance=guidance, generator=generator, File "/content/Diff-Harmonization/main.py", line 46, in run_harmonization_no_evaluator outimg, = diff_harmon.run(diffusion_model, prompts[0], controller, latent=x_t, File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) File "/content/Diff-Harmonization/diff_harmon.py", line 480, in run constraint_text_emb = attention_constraint_text_optimization(init_prompt, model, mask, latent, File "/content/Diff-Harmonization/diff_harmon.py", line 367, in attention_constraint_text_optimization attention_map_fg = aggregate_attention(prompt, controller, size // 32, ("up", "down"), True, 0).cuda() File "/content/Diff-Harmonization/utils.py", line 115, in aggregate_attention for item in attentionmaps[f"{location}{'cross' if is_cross else 'self'}"]: KeyError: 'up_cross'

WindVChen commented 1 month ago

Hi @Rajesh1215 ,

Please recheck your version of diffusers package. Version 0.9.0 should work well.

Hope this helps!

Rajesh1215 commented 1 month ago

thank you i will check that

Rajesh1215 commented 1 month ago

@WindVChen i have changed diffusers version but i got different error Traceback (most recent call last): File "/content/Diff-Harmonization/main.py", line 3, in from diffusers import StableDiffusionPipeline, DDIMScheduler File "/usr/local/lib/python3.10/dist-packages/diffusers/init.py", line 31, in from .pipeline_utils import DiffusionPipeline File "/usr/local/lib/python3.10/dist-packages/diffusers/pipeline_utils.py", line 38, in from .schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME File "/usr/local/lib/python3.10/dist-packages/diffusers/schedulers/init.py", line 38, in from .scheduling_ddpm_flax import FlaxDDPMScheduler File "/usr/local/lib/python3.10/dist-packages/diffusers/schedulers/scheduling_ddpm_flax.py", line 80, in class FlaxDDPMScheduler(FlaxSchedulerMixin, ConfigMixin): File "/usr/local/lib/python3.10/dist-packages/diffusers/schedulers/scheduling_ddpm_flax.py", line 216, in FlaxDDPMScheduler key: random.KeyArray, File "/usr/local/lib/python3.10/dist-packages/jax/_src/deprecations.py", line 55, in getattr raise AttributeError(f"module {module!r} has no attribute {name!r}") AttributeError: module 'jax.random' has no attribute 'KeyArray'

this is my colab file https://colab.research.google.com/drive/1mqu757wKRyvU8nuUDv32eDRPd1J4fu4-?authuser=1#scrollTo=-wCXjcP-eZXr

coulld you please help me to solve this error

WindVChen commented 1 month ago

Hi @Rajesh1215 ,

Apology for the delayed response. For the error above, the answer here may help.

Hope it helps.