Mikubill / sd-webui-controlnet

WebUI extension for ControlNet
GNU General Public License v3.0
16.89k stars 1.94k forks source link

Error when used with multiple diffusion upscaler #1601

Closed Veliante closed 10 months ago

Veliante commented 1 year ago

Tiled Diffusion Upscaling crashes everytime I try upscaling with controlnet activated. I tried without tiled diffusion activated and it does work, even with "none" as upscaler. But when I use any upscaler, "R-ESRGAN, 4x foolhardy, and even Swin-IR" it gives me this error:

[Mem] rss: 9.128 GB, vms: 26.045 GB [VRAM] free: 10.149 GB, total: 14.748 GB 2023-06-08 17:59:02,508 - ControlNet - INFO - Loading model from cache: control_v11p_sd15s2_lineart_anime [c58f338b] 2023-06-08 17:59:02,512 - ControlNet - INFO - API used default value: unit.threshold_a = 0 2023-06-08 17:59:02,512 - ControlNet - INFO - API used default value: unit.threshold_b = 0 2023-06-08 17:59:02,512 - ControlNet - INFO - Loading preprocessor: lineart_anime 2023-06-08 17:59:02,512 - ControlNet - INFO - Pixel Perfect Computation: 2023-06-08 17:59:02,512 - ControlNet - INFO - resize_mode = ResizeMode.INNER_FIT 2023-06-08 17:59:02,512 - ControlNet - INFO - raw_H = 1280 2023-06-08 17:59:02,513 - ControlNet - INFO - raw_W = 1024 2023-06-08 17:59:02,513 - ControlNet - INFO - target_H = 1280 2023-06-08 17:59:02,513 - ControlNet - INFO - target_W = 1024 2023-06-08 17:59:02,513 - ControlNet - INFO - estimation = 1024.0 2023-06-08 17:59:02,513 - ControlNet - INFO - preprocessor resolution = 1024 [Tiled Diffusion] upscaling image with SwinIR 4x... SwinIR tiles: 100% 42/42 [00:44<00:00, 1.05s/it] [Tiled Diffusion] ControlNet found, support is enabled. warn: noise inversion only supports the Euler sampler, switch to it sliently... Error completing request Arguments: ('task(7t23kubwu5p5bx7)', 0, ' 1girl, blonde hair, seductive expression, closed eyes, blush, cardigan, looking_at_viewer, masterpiece, long hair, sunset, beach', '(worst quality:1.25), (low quality:1.25), 8, (monochrome:1.1), (greyscale), multiple views, comic, sketch, easynegative, bad-hands-5, bad_prompt_version2', [], <PIL.Image.Image image mode=RGBA size=1024x1280 at 0x7F3E9CECB790>, None, None, None, None, None, None, 30, 17, 4, 0, 1, False, False, 1, 1, 7, 1.5, 0.55, -1.0, -1.0, 0, 0, 0, False, 0, 1280, 1024, 1, 0, 0, 32, 0, '', '', '', [], 0, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x7f3e9d08c760>, True, 'Mixture of Diffusers', False, False, 1024, 1024, 96, 96, 48, 4, 'SwinIR 4x', 2, True, 10, 1, 1, 64, False, False, False, False, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, False, 0.4, 0.4, 0.2, 0.2, '', '', 'Background', 0.2, -1.0, True, 612, 128, True, True, True, True, False, '', 0, '

\n CFG Scale should be 2 or lower. \n \n', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', ' Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8

', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', ' Will upscale the image by the selected scale factor; use width and height sliders to set tile size

', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, 50, ' Will upscale the image depending on the selected target size type

', 512, 0, 8, 32, 64, 0.35, 32, 0, True, 0, False, 8, 0, 0, 2048, 2048, 2) {} Traceback (most recent call last): File "/content/microsoftexcel/modules/call_queue.py", line 57, in f res = list(func(*args, kwargs)) File "/content/microsoftexcel/modules/call_queue.py", line 37, in f res = func(*args, *kwargs) File "/content/microsoftexcel/modules/img2img.py", line 178, in img2img processed = process_images(p) File "/content/microsoftexcel/modules/processing.py", line 610, in process_images res = process_images_inner(p) File "/content/microsoftexcel/extensions/microsoftexcel-controlnet/scripts/batch_hijack.py", line 42, in processing_process_images_hijack return getattr(processing, '__controlnet_original_process_images_inner')(p, args, kwargs) File "/content/microsoftexcel/modules/processing.py", line 670, in process_images_inner p.init(p.all_prompts, p.all_seeds, p.all_subseeds) File "/content/microsoftexcel/modules/processing.py", line 1139, in init self.sampler = sd_samplers.create_sampler(self.sampler_name, self.sd_model) File "/content/microsoftexcel/extensions/multidiffusion-upscaler-for-automatic1111/scripts/tilediffusion.py", line 373, in sd_samplers.create_sampler = lambda name, model: self.create_sampler_hijack( File "/content/microsoftexcel/extensions/multidiffusion-upscaler-for-automatic1111/scripts/tilediffusion.py", line 463, in create_sampler_hijack delegate.init_controlnet(self.controlnet_script, control_tensor_cpu) File "/content/microsoftexcel/extensions/multidiffusion-upscaler-for-automatic1111/tile_utils/utils.py", line 243, in wrapper return fn(*args, *kwargs) File "/content/microsoftexcel/extensions/multidiffusion-upscaler-for-automatic1111/tile_methods/abstractdiffusion.py", line 427, in init_controlnet self.prepare_controlnet_tensors() File "/content/microsoftexcel/extensions/multidiffusion-upscaler-for-automatic1111/tile_utils/utils.py", line 243, in wrapper return fn(args, **kwargs) File "/content/microsoftexcel/extensions/multidiffusion-upscaler-for-automatic1111/tile_methods/abstractdiffusion.py", line 466, in prepare_controlnet_tensors control_tile = torch.cat(single_batch_tensors, dim=0) RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 768 but got size 704 for tensor number 1 in the list. I have tried every setting, and searching online it says it's an error that happens when using SD 2.0 textual inversions, but when i disable controlnet everything works perfectly fine

lllyasviel commented 1 year ago

ControlNet is tested for multiple diffusion upscaler. I cannot reproduce this problem. Can you provide screenshots of all settings that will reproduce the problem?