dvruette / sd-webui-fabric

MIT License
403 stars 23 forks source link

Cant get this work #18

Closed ipinz closed 1 year ago

ipinz commented 1 year ago

Error completing request Arguments: ('task(xkh706x6m9k9sym)', '1girl (25 years old),(circled face, wide chin:1.2),( red hijab:1.2), long sleeve,orange T-shirt, (jeans:1.2), (random background:1.2), [full body shot], ((bokeh)), grey sweater,\nvery detailed face and eyes,4k,8k,highly detailed, high Detail, Sharp focus, detailed face,\nhigh-quality photo, (photorealistic),(hyper realistic), dynamic angle, dynamic pose, (extremely detailed photo),\n ', 'badhandv4 , nude, naked, (breast:1.2),', [], 20, 6, False, False, 1, 4, 7, -1.0, -1.0, 0, 0, 0, False, 768, 432, False, 0, 2, 'Latent', 0, 0, 0, 0, '', '', [], <gradio.routes.Request object at 0x000002350BC71F60>, 0, False, '', 0, False, False, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, 'LoRA', 'None', 0, 0, None, 'Refresh models', <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000002350999F8E0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000002350999F3D0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x000002350999FAC0>, [<PIL.Image.Image image mode=RGB size=432x768 at 0x2350970C190>, <PIL.Image.Image image mode=RGB size=432x768 at 0x2350970C520>], [<PIL.Image.Image image mode=RGB size=432x768 at 0x2350970C610>, <PIL.Image.Image image mode=RGB size=432x768 at 0x2350970C1F0>], False, 4, 0, 0.8, 0, 0.8, 0.5, False, 0, None, False, '0', 'D:\_AI_stableDiffusion\stable-diffusion-webui\models\roop\inswapper_128.onnx', 'CodeFormer', 1, '', 1, 1, False, True, None, False, '0', 'D:\_AI_stableDiffusion\stable-diffusion-webui\models\roop\inswapper_128.onnx', 'CodeFormer', 1, '', 1, 1, False, True, False, False, False, False, '1:1,1:2,1:2', '0:0,0:0,0:1', '0.2,0.8,0.8', 20, 0.2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, None, None, False, None, None, False, 50) {} Traceback (most recent call last): File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 58, in f res = list(func(*args, kwargs)) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(*args, *kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\txt2img.py", line 62, in txt2img processed = processing.process_images(p) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\processing.py", line 677, in process_images res = process_images_inner(p) File "D:_AI_stableDiffusion\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack return getattr(processing, '__controlnet_original_process_images_inner')(p, args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\processing.py", line 794, in process_images_inner samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts) File "D:_AI_stableDiffusion\stable-diffusion-webui\extensions\sd-webui-fabric\scripts\marking.py", line 28, in process_sample return process.sample_before_CN_hack(*args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\processing.py", line 1054, in sample samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x)) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 464, in sample samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args={ File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 303, in launch_sampling return func() File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 464, in samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args={ File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(*args, *kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 553, in sample_dpmpp_sde denoised = model(x, sigmas[i] s_in, extra_args) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 202, in forward x_out[a:b] = self.inner_model(x_in[a:b], sigma_in[a:b], cond=make_condition_dict(c_crossattn, image_cond_in[a:b])) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\external.py", line 112, in forward eps = self.get_eps(input c_in, self.sigma_to_t(sigma), kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\external.py", line 138, in get_eps return self.inner_model.apply_model(*args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\sd_hijack_utils.py", line 17, in setattr(resolved_obj, func_path[-1], lambda *args, *kwargs: self(args, kwargs)) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\sd_hijack_utils.py", line 28, in call return self.orig_func(args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 858, in apply_model x_recon = self.model(x_noisy, t, cond) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\models\diffusion\ddpm.py", line 1335, in forward out = self.diffusion_model(x, t, context=cc) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\extensions\sd-webui-fabric\scripts\patching.py", line 199, in new_forward out = self._fabric_old_forward(x, timesteps, context, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\sd_unet.py", line 91, in UNetModel_forward return ldm.modules.diffusionmodules.openaimodel.copy_of_UNetModel_forward_for_webui(self, x, timesteps, context, args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\openaimodel.py", line 799, in forward h = self.middle_block(h, emb, context) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\openaimodel.py", line 84, in forward x = layer(x, context) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, *kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\attention.py", line 334, in forward x = block(x, context=context[i]) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\attention.py", line 269, in forward return checkpoint(self._forward, (x, context), self.parameters(), self.checkpoint) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\util.py", line 121, in checkpoint return CheckpointFunction.apply(func, len(inputs), args) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\autograd\function.py", line 506, in apply return super().apply(args, kwargs) # type: ignore[misc] File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\diffusionmodules\util.py", line 136, in forward output_tensors = ctx.run_function(ctx.input_tensors) File "D:_AI_stableDiffusion\stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\attention.py", line 272, in _forward x = self.attn1(self.norm1(x), context=context if self.disable_self_attn else None) + x File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\extensions\sd-webui-fabric\scripts\patching.py", line 178, in patched_attn1_forward out_cond = weighted_attention(attn1, attn1._fabric_old_forward, x_cond, ctx_cond, ws, kwargs) # (n_cond, seq, dim) File "D:_AI_stableDiffusion\stable-diffusion-webui\extensions\sd-webui-fabric\scripts\weighted_attention.py", line 157, in weighted_attention out = attn_fn(x, context=context, kwargs) File "D:_AI_stableDiffusion\stable-diffusion-webui\modules\sd_hijack_optimizations.py", line 489, in xformers_attention_forward out = xformers.ops.memory_efficient_attention(q, k, v, attn_bias=None, op=get_xformers_flash_attention_op(q, k, v)) File "D:_AI_stableDiffusion\stable-diffusion-webui\extensions\sd-webui-fabric\scripts\weighted_attention.py", line 45, in patched_xformers_attn return orig_attn(q, k, v, attn_bias=attn_bias, op=op) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\xformers\ops\fmha__init__.py", line 192, in memory_efficient_attention return _memory_efficient_attention( File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\xformers\ops\fmha__init__.py", line 290, in _memory_efficient_attention return _memory_efficient_attention_forward( File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\xformers\ops\fmha\init__.py", line 306, in _memory_efficient_attention_forward op = _dispatch_fw(inp) File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\xformers\ops\fmha\dispatch.py", line 94, in _dispatch_fw return _run_priority_list( File "D:_AI_stableDiffusion\stable-diffusion-webui\venv\lib\site-packages\xformers\ops\fmha\dispatch.py", line 69, in _run_priority_list raise NotImplementedError(msg) NotImplementedError: No operator found for memory_efficient_attention_forward with inputs: query : shape=(4, 84, 8, 160) (torch.float16) key : shape=(4, 252, 8, 160) (torch.float16) value : shape=(4, 252, 8, 160) (torch.float16) attn_bias : <class 'torch.Tensor'> p : 0.0 cutlassF is not supported because: attn_bias.stride(-2) % 8 != 0 (attn_bias.stride() = (169344, 21168, 252, 1)) HINT: To use an attn_bias with a sequence length that is not a multiple of 8, you need to ensure memory is aligned by slicing a bigger tensor. Example: use attn_bias = torch.zeros([1, 1, 5, 8])[:,:,:,:5] instead of torch.zeros([1, 1, 5, 5]) flshattF is not supported because: max(query.shape[-1] != value.shape[-1]) > 128 attn_bias type is <class 'torch.Tensor'> tritonflashattF is not supported because: max(query.shape[-1] != value.shape[-1]) > 128 attn_bias type is <class 'torch.Tensor'> Operator wasn't built - see python -m xformers.info for more info triton is not available requires A100 GPU smallkF is not supported because: dtype=torch.float16 (supported: {torch.float32}) max(query.shape[-1] != value.shape[-1]) > 32 bias with non-zero stride not supported unsupported embed per head: 160

dvruette commented 1 year ago

I've seen a similar error before, but haven't been able to reproduce in a while. My recommendations: 1) update FABRIC to the latest version and 2) prefer --opt-split-attention over --xformers when using FABRIC for most efficient VRAM usage.

Updating alone should already fix the issue. If it doesn't, please let me know what OS/GPU you're using.

Gushousekai195 commented 1 year ago

The VRAM usage on my RTX 3090 with 24gb is massive, even with --opt-split-attention and token merging on with default settings, the usage is almost topped out!

dvruette commented 1 year ago

With the recent bugfixes, I now recommend running --xformers over --opt-split-attention due to the improved memory usage. On my machine (also RTX 3090), I was able to run up to 16 feedback images with those settings. How many feedback images are you using in your setup?