Kosinkadink / ComfyUI-Advanced-ControlNet

ControlNet scheduling and masking nodes with sliding context support
GNU General Public License v3.0
561 stars 56 forks source link

Can a ControlNet and SparseCtrl be used at the same time? #174

Closed aihopper closed 3 weeks ago

aihopper commented 4 weeks ago

If so I'd be great to have a simple/minimal example that shows how to do it :)

Kosinkadink commented 4 weeks ago

In terms of "working", yes. Just connect them to each other

aihopper commented 3 weeks ago

It took me a bit to figure out but finally it clicked, I think you meant this way?

image

The problem is that when I add the red part, I get this error and I am not very sure how to proceed

!!! Exception during processing !!! Given groups=1, weight of size [320, 5, 3, 3], expected input[32, 4, 64, 64] to have 5 channels, but got 4 channels instead
Traceback (most recent call last):

[...]

  File "/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nodes.py", line 1429, in sample
    return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nodes.py", line 1396, in common_ksampler
    samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/sampling.py", line 116, in acn_sample
    return orig_comfy_sample(model, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 116, in uncond_multiplier_check_cn_sample
    return orig_comfy_sample(model, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 526, in motion_sample
    latents = orig_comfy_sample(model, noise, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/comfy/sample.py", line 43, in sample
    samples = sampler.sample(noise, positive, negative, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[...]

I tried swapping SparseCtrl and ControlNet and got the same result.

Do you have any recommendation on how to debug this?

Kosinkadink commented 3 weeks ago

To use SparseRGB, you must use the SparseRGB preprocessor for the input image

Kosinkadink commented 3 weeks ago

I think I used to have a readable error when that happens, I must have accidentally changed something that caused it to no longer get displayed. I'll try to push an update in the next couple days to bring it back.

aihopper commented 3 weeks ago

like this?

image

I am getting exactly the same error. Also the output is "image_PROC" and not "image" is that ok?

Kosinkadink commented 3 weeks ago

You accidentally plugged the preprocessed images into your depth CN instead of SparseRGB

aihopper commented 3 weeks ago

Arg!, you were faster than me, I just noticed that :) All seems to work now! :)