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

SDNEXT: Hypertile error / TypeError: xformers_attention_forward() got an unexpected keyword argument 'agent' #10

Open RGX650 opened 6 months ago

RGX650 commented 6 months ago

7:12:36-721823 ERROR Hypertile error: width=512 height=768 xformers_attention_forward() got an unexpected keyword argument 'agent' 07:12:36-726157 ERROR Exception: xformers_attention_forward() got an unexpected keyword argument 'agent' ... 07:12:36-756215 ERROR gradio call: TypeError ╭────────────────────────────── Traceback (most recent call last) ─────────────────────────────╮ │ C:\AI\SDNEXT\automatic\modules\sd_hijack_hypertile.py:112 in wrapper
││
││ 111 │ │ │ │ │ │ x = rearrange(x, "b (nh h nw w) c -> (b nh nw) (h w) c", h=h //
││ ❱ 112 │ │ │ │ │ out = forward(x, *args[1:], **kwargs)
││ 113 │ │ │ │ │ if do_split: │╰───────────────────────────────────────────────────────────────────────────────╯ TypeError: xformers_attention_forward() got an unexpected keyword argument 'agent'

During handling of the above exception, another exception occurred:

╭───────────────────────────── Traceback (most recent call last) ──────────────────────────────╮ │ C:\AI\SDNEXT\automatic\modules\call_queue.py:31 in f
││
││ 30 │ │ │ try:
││ ❱ 31 │ │ │ │ res = func(*args, kwargs)
││ 32 │ │ │ │ progress.record_results(id_task, res)
││
││ C:\AI\SDNEXT\automatic\modules\txt2img.py:88 in txt2img
││
││ 87 │ if processed is None:
││ ❱ 88 │ │ processed = processing.process_images(p)
││ 89 │ p.close()
││
││ C:\AI\SDNEXT\automatic\modules\processing.py:760 in process_images
││
││ 759 │ │ │ with context_hypertile_vae(p), context_hypertile_unet(p):
││ ❱ 760 │ │ │ │ res = process_images_inner(p)
││ 761
││
││ C:\AI\SDNEXT\automatic\extensions-builtin\sd-webui-controlnet\scripts\batch_hijack.py:42 in
││ processing_process_images_hijack
││
││ 41 │ │ │ # we are not in batch mode, fallback to original function
││ ❱ 42 │ │ │ return getattr(processing, '__controlnet_original_process_images_inner')(p,
││ 43
││
││ C:\AI\SDNEXT\automatic\modules\processing.py:900 in process_images_inner
││
││ 899 │ │ │ │ with devices.without_autocast() if devices.unet_needs_upcast else device
││ ❱ 900 │ │ │ │ │ samples_ddim = p.sample(conditioning=c, unconditional_conditioning=u
││ 901 │ │ │ │ x_samples_ddim = [decode_first_stage(p.sd_model, samples_ddim[i:i+1].to(
││
││ ... 36 frames hidden ...
││
││ C:\AI\SDNEXT\automatic\venv\lib\site-packages\torch\utils\checkpoint.py:230 in forward
││
││ 229 │ │ with torch.no_grad():
││ ❱ 230 │ │ │ outputs = run_function(args)
││ 231 │ │ return outputs
││
││ C:\AI\SDNEXT\automatic\extensions\sd-webui-agentattention-SDNEXT\agentsd\patch.py:78 in _forward
││
││ 77 │ │ │ feature, agent = m_a(y)
││ ❱ 78 │ │ │ x = u_a(self.attn1(feature, agent=agent, context=context if self.disable_sel
││ 79 │ │ │ y = self.norm2(x)
││
││ C:\AI\SDNEXT\automatic\venv\lib\site-packages\torch\nn\modules\module.py:1518 in _wrapped_call_impl
││
││ 1517 │ │ else:
││ ❱ 1518 │ │ │ return self._call_impl(
args,
kwargs)
││ 1519
││
││ C:\AI\SDNEXT\automatic\venv\lib\site-packages\torch\nn\modules\module.py:1527 in _call_impl
││
││ 1526 │ │ │ │ or _global_forward_hooks or _global_forward_pre_hooks):
││ ❱ 1527 │ │ │ return forward_call(*args, *kwargs)
││ 1528
││
││ C:\AI\SDNEXT\automatic\modules\sd_hijack_hypertile.py:120 in wrapper
││
││ 119 │ │ │ │ │ │ log.error(f'Hypertile error: width={width} height={height} {e}')
││ ❱ 120 │ │ │ │ │ out = forward(x,
args[1:], **kwargs)
││ 121 │ │ │ return out │╰──────────────────────────────────────────────────────────────────────────────╯ TypeError: xformers_attention_forward() got an unexpected keyword argument 'agent'

AG-w commented 5 months ago

same here, this extension is straight up broken

Derjyn commented 4 months ago

I also get this error, and it's not predictable. Sometimes it's when I toggle X thing over at Y, sometimes not. Sometimes it's on the 5th picture generated after disabling Agent Attention, sometimes never.

Also, not 100% convinced the "remove patch" button actually removes the patch, as, after hitting that, disabling Agent Attention, disabling, killing SDUI, then deleting the sd-webui-agentattention folder altogether... I got that unexpected keyword argument 'agent' error randomly after a few basic generate runs.

I've now re-installed and re-enabled this plugin, and if I am actively thinking of it, I'll try and record some more helpful data when the error arises, if at all possible.