LeapLabTHU / Agent-Attention

Official repository of Agent Attention (ECCV2024)
473 stars 35 forks source link

Black Images Generated #26

Open saqibameen opened 6 months ago

saqibameen commented 6 months ago

When I try to run agentsd with stable diffusion v2.1, it generates black images. Sample below:

image

I have added agentsd folder to the root and following lines of code

  import agentsd
  if i == 0:
      agentsd.remove_patch(self.model)
      agentsd.apply_patch(self.model, sx=4, sy=4, ratio=0.4, agent_ratio=0.95, attn_precision="fp32")
  elif i == 20:
      agentsd.remove_patch(self.model)
      agentsd.apply_patch(self.model, sx=2, sy=2, ratio=0.4, agent_ratio=0.5, attn_precision="fp32")

to the ldm/models/diffusion/ddim.py file after L152 as per the instructions. Without this, it works fine.

tian-qing001 commented 6 months ago

Hi @saqibameen. Thank you for your interest in our work. The appearance of black images may stem from unstable numerical values encountered on SDv2.1. Could you please confirm whether attn_precision="fp32" has been set? This line.

saqibameen commented 6 months ago

Hi @tian-qing001, thanks for the response. I did set that. Apparently, I had to manually change a couple of files in SDv1.2 to make it work. However, the inference time increased almost x2.