Kosinkadink / ComfyUI-Advanced-ControlNet

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

while run in ksampler, raise error #126

Closed trouble-maker007 closed 4 months ago

trouble-maker007 commented 4 months ago
Error occurred when executing KSampler:

0

File "/home/work/ComfyUI/execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/home/work/ComfyUI/execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/home/work/ComfyUI/execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/home/work/ComfyUI/nodes.py", line 1371, in sample
return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
File "/home/work/ComfyUI/nodes.py", line 1341, in common_ksampler
samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control_reference.py", line 47, in refcn_sample
return orig_comfy_sample(model, *args, **kwargs)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 111, in uncond_multiplier_check_cn_sample
return orig_comfy_sample(model, *args, **kwargs)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/modules/impact/sample_error_enhancer.py", line 9, in informative_sample
return original_sample(*args, **kwargs) # This code helps interpret error messages that occur within exceptions but does not have any impact on other operations.
File "/home/work/ComfyUI/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)
File "/home/work/ComfyUI/comfy/samplers.py", line 795, in sample
return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed)
File "/home/work/ComfyUI/comfy/samplers.py", line 697, in sample
return cfg_guider.sample(noise, latent_image, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
File "/home/work/ComfyUI/comfy/samplers.py", line 684, in sample
output = self.inner_sample(noise, latent_image, device, sampler, sigmas, denoise_mask, callback, disable_pbar, seed)
File "/home/work/ComfyUI/comfy/samplers.py", line 663, in inner_sample
samples = sampler.sample(self, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
File "/home/work/ComfyUI/comfy/samplers.py", line 568, in sample
samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
File "/home/work/miniconda3/envs/comfyui/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/work/ComfyUI/comfy/k_diffusion/sampling.py", line 600, in sample_dpmpp_2m
denoised = model(x, sigmas[i] * s_in, **extra_args)
File "/home/work/ComfyUI/comfy/samplers.py", line 291, in __call__
out = self.inner_model(x, sigma, model_options=model_options, seed=seed)
File "/home/work/ComfyUI/comfy/samplers.py", line 650, in __call__
return self.predict_noise(*args, **kwargs)
File "/home/work/ComfyUI/comfy/samplers.py", line 653, in predict_noise
return sampling_function(self.inner_model, x, timestep, self.conds.get("negative", None), self.conds.get("positive", None), self.cfg, model_options=model_options, seed=seed)
File "/home/work/ComfyUI/comfy/samplers.py", line 277, in sampling_function
out = calc_cond_batch(model, conds, x, timestep, model_options)
File "/home/work/ComfyUI/comfy/samplers.py", line 200, in calc_cond_batch
c['control'] = control.get_control(input_x, timestep_, c, len(cond_or_uncond))
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 706, in get_control_inject
return self.get_control_advanced(x_noisy, t, cond, batched_number)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 34, in get_control_advanced
return self.sliding_get_control(x_noisy, t, cond, batched_number)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 39, in sliding_get_control
control_prev = self.previous_controlnet.get_control(x_noisy, t, cond, batched_number)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 706, in get_control_inject
return self.get_control_advanced(x_noisy, t, cond, batched_number)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 34, in get_control_advanced
return self.sliding_get_control(x_noisy, t, cond, batched_number)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 39, in sliding_get_control
control_prev = self.previous_controlnet.get_control(x_noisy, t, cond, batched_number)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 706, in get_control_inject
return self.get_control_advanced(x_noisy, t, cond, batched_number)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 34, in get_control_advanced
return self.sliding_get_control(x_noisy, t, cond, batched_number)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 84, in sliding_get_control
return self.control_merge(None, control, control_prev, output_dtype)
File "/home/work/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 827, in control_merge_inject
x = control_output[i]

I print the output near x = control_output[i]

if control_output is not None:
            for i in range(len(control_output)):
                print('=' * 20)
                print(len(control_output))
                print(type(control_output))
                print(control_output.keys())
                print('=' * 20)
                if i == (len(control_output) - 1):
                    key = 'middle'
                    index = 0
                else:
                    key = 'output'
                    index = i
                x = control_output[i]

##### output
2
<class 'dict'>
dict_keys(['middle', 'output'])

I use the controlnet in here:https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main and try to run the workflow of: https://openart.ai/workflows/grinlau/change-background/DoiYOkLj6ikwIbygd4gY

Kosinkadink commented 4 months ago

Make sure both your ComfyUI and Advanced-ControlNet are updated to the latest. Based on your print statements, your ComfyUI is a recent version, but Advanced-ControlNet is outdated. ComfyUI had an update last week that breaks backwards compatibility with previous versions of Advanced-ControlNet, and I pushed an update to work with it.

You can check your Advanced-ControlNet version by looking in the pyproject.toml file.

Here is the PSA issue I created for the breaking changes: https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/124

trouble-maker007 commented 4 months ago

@Kosinkadink thanks for the quickly response, I update and try again

Uli2410 commented 4 months ago

pyproject.toml

Hello! did you solve the problem?

Kosinkadink commented 4 months ago

@Uli2410 simply update Advanced-ControlNet. More info here https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/124#issuecomment-2205478442

Uli2410 commented 4 months ago

@Uli2410 simply update Advanced-ControlNet. More info here #124 (comment)

Ok! Thank u!

Uli2410 commented 4 months ago

The error does not disappear... I updated comfyui and controlnet

ср, 3 лип. 2024 р. о 12:03 Jedrzej Kosinski @.***> пише:

@Uli2410 https://github.com/Uli2410 simply update Advanced-ControlNet. More info here #124 (comment) https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/124#issuecomment-2205478442

— Reply to this email directly, view it on GitHub https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/126#issuecomment-2205479899, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEMQJJYRE5OKSWCMGYPO3MDZKO473AVCNFSM6AAAAABKHZWRHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBVGQ3TSOBZHE . You are receiving this because you were mentioned.Message ID: @.***>

Uli2410 commented 4 months ago

![Uploading Untitled-1.jpg…]()

Kosinkadink commented 4 months ago

Your screenshot didn't get uploaded for some reason, but if you still get the same error, that means your Advanced-ControlNet didn't update.

Check inside your pyproject.toml file inside ComfyUI-Advanced-ControlNet. It should be at least version = "1.1.0" if it updated.

Uli2410 commented 4 months ago

Your screenshot didn't get uploaded for some reason, but if you still get the same error, that means your Advanced-ControlNet didn't update.

Check inside your pyproject.toml file inside ComfyUI-Advanced-ControlNet. It should be at least version = "1.1.0" if it updated.

ddd

Uli2410 commented 4 months ago

Your screenshot didn't get uploaded for some reason, but if you still get the same error, that means your Advanced-ControlNet didn't update.

Check inside your pyproject.toml file inside ComfyUI-Advanced-ControlNet. It should be at least version = "1.1.0" if it updated.

controlnet is v1.1.0

Kosinkadink commented 4 months ago

Did you make sure to restart ComfyUI after updating?

Uli2410 commented 4 months ago

Did you make sure to restart ComfyUI after updating?

yes, and computer too

Kosinkadink commented 4 months ago

@Uli2410 I think we had a miscommunication. You do not have the same error as this thread is talking about.

Looking closely at the sliver of console visible in your screenshot, the error you're actually getting is something like "object has no attribute 'latent_format'", right?

That is already mentioned in https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/124#issue-2379529101, specifically when your AdvancedControlNet is okay but it's ComfyUI that is still a version prior to when ComfyUI made the breaking ControlNet changes.

Update your ComfyUI, whatever you tried to update ComfyUI did not work. Latent_format is not my variable, it is a variable that exists within ComfyUI's vanilla controlnets that I am extending, so it's 100% the reason for your error.

Uli2410 commented 4 months ago

Ok, thanks for the clarification.

ср, 3 лип. 2024 р. о 17:19 Jedrzej Kosinski @.***> пише:

@Uli2410 https://github.com/Uli2410 I think we had a miscommunication. You do not have the same error as this thread is talking about.

Looking closely at the sliver of console visible in your screenshot, the error you're actually getting is something like "object has no attribute 'latent_format'", right?

That is already mentioned in #124 (comment) https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/124#issue-2379529101, specifically when your AdvancedControlNet is okay but it's ComfyUI that is still a version prior to when ComfyUI made the breaking ControlNet changes.

Update your ComfyUI, whatever you tried to update ComfyUI did not work. Latent_format is not my variable, it is a variable that exists within ComfyUI's vanilla controlnets that I am extending, so it's 100% the reason for your error.

— Reply to this email directly, view it on GitHub https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet/issues/126#issuecomment-2206255183, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEMQJJ4D4QIG2WZTWJIENQTZKQCAJAVCNFSM6AAAAABKHZWRHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBWGI2TKMJYGM . You are receiving this because you were mentioned.Message ID: @.***>