HelenMao / MAG-Edit

MAG-Edit: Localized Image Editing in Complex Scenarios via Mask-Based Attention-Adjusted Guidance (ACM MM2024)
https://mag-edit.github.io/
87 stars 1 forks source link

hello! I get the following problem when I run edit.py, what can I do to fix it: #3

Open Y-T-cyber opened 1 month ago

Y-T-cyber commented 1 month ago

Traceback (most recent call last): File "edit.py", line 54, in images, _ = run_and_displayloss_TR(prompts, controller, run_baseline=False, latent=x_t, File "edit.py", line 9, in run_and_displayloss_TR images, x_t = text2image_ldm_stable_TR(ldm_stable, prompts, controller, latent=latent, File "/data-c/heyiliang/anaconda3/envs/mag/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, *kwargs) File "/data-c/heyiliang/code/MAG-Edit/code_tr/network.py", line 919, in text2image_ldm_stable_TR latent_optimize_new =update_latent_TR(model, latents1, latents2, text_embeddings1, text_embeddings2,None,controller, t,i,max_iter=max_iter,scale=scale) File "/data-c/heyiliang/code/MAG-Edit/code_tr/network.py", line 829, in update_latent_TR loss3 = compute_ca_TR(atten, controller.adj_mask, controller.word, controller.prompt) File "/data-c/heyiliang/code/MAG-Edit/code_tr/network.py", line 751, in compute_ca_TR loss = loss / (len(attn_maps) (len(word[1]))) ZeroDivisionError: float division by zero

bimsarapathiraja commented 2 weeks ago

Me too

Orannue commented 1 week ago

Thank you for your interest in our work! Could you please provide the script you are running and print out len(attn_maps) and len(word[1]) to check if they are zero? This will help us determine if there is an issue with the --target_word parameter or with saving the CA Maps.