v0xie / sd-webui-agentattention

Speed up image generation and improve image quality using Agent Attention.
GNU General Public License v3.0
39 stars 3 forks source link

Extremely slow after first generation #3

Open younyokel opened 6 months ago

younyokel commented 6 months ago

I generated an image using Apply to Hires. Fix Only option and at first the speed was fine, but after the first pass the generation became very slow, from around 9 seconds to a minute and 20 seconds. Tried unloading and reloading the model, changing the model, but it still remained at that speed.

younyokel commented 6 months ago

Let me add that the speed is due to high VRAM usage ("CUDA out of memory. Tried to allocate 15.12 GiB") which my GPU can't handle. However, the extension keeps working when the Active checkbox is unchecked. When I uncheck the "Active" checkbox after the first run, the extension seems to stay enabled and continues to be very slow.

v0xie commented 6 months ago

Thanks for the report - I can reproduce this behavior on my end.

After doing some profiling, I think the issue is that the AgentAttention module overrides the Cross Attention optimization setting in sd_hijack_optimizations.py. I'll have to figure out how to restore the original forward respecting those settings.