continue-revolution / sd-webui-segment-anything

Segment Anything for Stable Diffusion WebUI
3.41k stars 206 forks source link

[Bug]: extension breaks img2img with the new automatic1111 1.1 and controlnet #73

Closed Dasor92 closed 1 year ago

Dasor92 commented 1 year ago

Is there an existing issue for this?

Have you updated WebUI and this extension to the newest version?

Do you understand that you should go to https://github.com/IDEA-Research/Grounded-Segment-Anything/issues if you cannot install GroundingDINO?

Do you know that you should use the newest ControlNet extension and enable external control if you want SAM extension to control ControlNet?

What happened?

if you have controlnet and segment anything extensions activated the img2img tab doesn't work anymore it throws an error: Disabling ControlNet or Segment Anything fixes the problem.

Traceback (most recent call last): File "D:\Programmi\stable-diffusion-webui\modules\call_queue.py", line 57, in f res = list(func(*args, *kwargs)) File "D:\Programmi\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(args, **kwargs) File "D:\Programmi\stable-diffusion-webui\modules\img2img.py", line 181, in img2img processed = process_images(p) File "D:\Programmi\stable-diffusion-webui\modules\processing.py", line 515, in process_images res = process_images_inner(p) File "D:\Programmi\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 39, in processing_process_images_hijack cn_is_batch, batches, output_dir, input_file_names = get_cn_batches(p) File "D:\Programmi\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 185, in get_cn_batches units = [copy(unit) for unit in units if unit.enabled] File "D:\Programmi\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 185, in units = [copy(unit) for unit in units if unit.enabled] AttributeError: 'list' object has no attribute 'enabled'

Steps to reproduce the problem

  1. Go to img2img tab with both segment anything and controlnet extensions
  2. Press generate
  3. See error

What should have happened?

It should work like before

Commit where the problem happens

webui: 72cd27a1 extension: 14a0a1f Controlnet: 6315bec

What browsers do you use to access the UI ?

No response

Command Line Arguments

--xformers --api --listen --enable-insecure-extension-access

Console logs

No error in console log: but here's the full request:

Error completing request
Arguments: ('task(9fz8gx4fo758f66)', 0, '((masterpiece,best quality))1girl, solo, black skirt, blue eyes, electric guitar, guitar, headphones, holding, holding plectrum, instrument, long hair, , music, one side up, pink hair, playing guiter, pleated skirt, black shirt, indoors', 'EasyNegative, extra fingers,fewer fingers,', [], <PIL.Image.Image image mode=RGBA size=864x512 at 0x2244D34BC10>, None, None, None, None, None, None, 20, 1, 4, 0, 1, False, False, 1, 1, 10, 1.5, 0.58, 505540.0, -1.0, 0, 0, 0, False, 0, 512, 864, 1, 0, 0, 32, 0, '', '', '', ['Model hash: a074b8864e'], 0, 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, True, False, 0, -1, <controlnet.py.UiControlNetUnit object at 0x000002244DA0E740>, <controlnet.py.UiControlNetUnit object at 0x0000022454163430>, <controlnet.py.UiControlNetUnit object at 0x000002244D33EDD0>, <controlnet.py.UiControlNetUnit object at 0x00000224375C9930>, False, '', 0.5, True, False, '', 'Lerp', False, 'dynamic_thresholding;dynamic_prompting', True, True, True, False, 2, 'Original', 32, 18, 512, 512, 0.1, 'Original', 'Original', True, True, 'Inner', 'Original', 'sam_vit_b_01ec64.pth', 'groundingdino_swint_ogc.pth', True, 0, 4, True, 'Original', 8, 'Original', 'Original', 'Original', 'Original', '', '', '', '', '', '', 0.4, 0.4, 0, 0, 0, 0, True, True, 16, 16, 0, 0, 'Text', 'Center', None, 100, 100, '', None, 'Courier New', 50, 10, 0.4, 'none', 1.1, 2, 150, 3, 2, 1.1, 1.1, 1.1, 0, 10, 10, 'warm', 'Arabica%2012.CUBE', '', '', 0.8, 0, 0, 64, 'None', False, False, 0, None, [], 0, False, [], [], False, 0, 1, False, False, 0, None, [], -2, False, [], False, False, False, '<ul>\n<li><code>CFG Scale</code> should be 2 or lower.</li>\n</ul>\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, True, True, '', False, 1, 'Both ▦', False, '', False, False, True, False, False, False, False, 0, False, '', '', '', 'generateMasksTab', 1, 4, 2.5, 30, 1.03, 1, 1, 5, 0.5, 5, False, True, False, 20, '', False, 'Normal', 1, True, 1, 1, 'None', False, False, False, 'YuNet', 512, 1024, 0.5, 1.5, False, 'face close up,', 0.5, 0.5, False, True, [], True, True, True, 0.0, 0, None, 'gif', '<p style="margin-bottom:0.75em"><strong>Loops:</strong> The number of times the script will inference your image and increase the resolution in increments. The amount the resolution is increased each loop is determined by this number and the maximum image width/height.  The more loops, the more chances of your image picking up more detail, but also artifacts.  4 to 10 is what I find to work best, but you may like more or less.<br><br><strong>Denoise change:</strong> This setting will increase or decrease the denoising strength every loop.  A higher value will increase the denoising strength, while a lower value will decrease it. A setting of 1 keeps the denoising strength as it is set on the img2img settings.<br><br><strong>Adaptive change:</strong> This setting changes the amount of resolution increase per loop, keeping the changes from being linear.  The higher the value the more significant the resolution changes toward the end of the looping.<br><br><strong>Maximum Image Width/Height:</strong> These parameters set the maximum width and height of the final image. Always start with an image smaller than these dimensions.  The smaller you start, the more impressive the results. I usually start at either 340x512 or 512x768<br><br><strong>Detail, Blur, Smooth, Contour:</strong> These parameters are checkboxes that apply a PIL Image Filter to the final image.<br><br><strong>Sharpness, Brightness, Color, Contrast:</strong> These parameters are sliders that adjust the sharpness, brightness, color, and contrast of the image. 1 will result in no adjustments, less than one reduces these settings for the final image and greater than 1 increases these settings.<br><br><strong>Img2Img Settings:</strong>  I recommend creating an image with txt2img and then sending the result to img2img with the prompt and settings.  For this script I use these settings..<br><br><strong>Resize mode -</strong> Crop and resize<br><strong>Sampling method -</strong> DDIM<br><strong>Sampling steps -</strong> 30<br><strong>Width/Height -</strong> 340x512 or 512x768.  I’d try to keep to the aspect ratio of the original image but these can be set lower than the resolution of the original image<br><strong>CFG Scale -</strong> 6 to 8<br><strong>Denoising strength -</strong> 0.2 to 0.4 is usual.  The lower you go, the less change between loops.  The higher you go the less the end result will look like the original image.<br><strong>Seed -</strong> This doesn’t matter too much, I usually keep it at -1</p></p>', 4, 1, 1024, 1024, 'None', 'None', False, 'None', 1, 1, 1, 1, 1, None, False, None, False, None, False, None, False, 50, 0, 0, 384, 384, False, True, False, False, 0, 1, False, 1, True, True, False, False, ['left-right', 'red-cyan-anaglyph'], 2.5, 'polylines_sharp', 0, False, False, False, False, False, False, 'u2net', False, True, False, '<p style="margin-bottom:0.75em">Will upscale the image depending on the selected target size type</p>', 512, 0, 8, 32, 64, 0.35, 32, 0, True, 0, False, 8, 0, 0, 2048, 2048, 2, '', '', False, '', 127, False, 30, 9999, 1, False, 10, 0.25, True, False, 'simple', '1', '', True, '', '', '', '', '', '', '', '', '', '', '', '', 'None', 0.3, 60) {}
Traceback (most recent call last):
  File "D:\Programmi\stable-diffusion-webui\modules\call_queue.py", line 57, in f
    res = list(func(*args, **kwargs))
  File "D:\Programmi\stable-diffusion-webui\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "D:\Programmi\stable-diffusion-webui\modules\img2img.py", line 181, in img2img
    processed = process_images(p)
  File "D:\Programmi\stable-diffusion-webui\modules\processing.py", line 515, in process_images
    res = process_images_inner(p)
  File "D:\Programmi\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 39, in processing_process_images_hijack
    cn_is_batch, batches, output_dir, input_file_names = get_cn_batches(p)
  File "D:\Programmi\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 185, in get_cn_batches
    units = [copy(unit) for unit in units if unit.enabled]
  File "D:\Programmi\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 185, in <listcomp>
    units = [copy(unit) for unit in units if unit.enabled]
AttributeError: 'list' object has no attribute 'enabled'

Additional information

No response

continue-revolution commented 1 year ago

Closed via https://github.com/Mikubill/sd-webui-controlnet/pull/1130