Kosinkadink / ComfyUI-Advanced-ControlNet

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

[Update your ComfyUI to fix if you haven't updated since before Nov. 1st] Error occurred when executing KSampler: 'NoneType' object has no attribute 'strength' #32

Closed xliry closed 6 months ago

xliry commented 7 months ago

Hello i was using without any problem until this morning, i start taken this error log. i think problem is Load advanced controlnet model. when i try with Load Controlnet Model Ksampler working well

ERROR:root:!!! Exception during processing !!! ERROR:root:Traceback (most recent call last): File "/content/drive/MyDrive/ComfyUI/execution.py", line 153, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/content/drive/MyDrive/ComfyUI/execution.py", line 83, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "/content/drive/MyDrive/ComfyUI/execution.py", line 76, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "/content/drive/MyDrive/ComfyUI/nodes.py", line 1236, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) File "/content/drive/MyDrive/ComfyUI/nodes.py", line 1206, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, File "/content/drive/MyDrive/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 "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 163, in animatediff_sample return wrap_function_to_inject_xformers_bug_info(orig_comfy_sample)(model, args, kwargs) File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/model_utils.py", line 185, in wrapped_function return function_to_wrap(args, kwargs) File "/content/drive/MyDrive/ComfyUI/comfy/sample.py", line 97, in sample samples = sampler.sample(noise, positive_copy, negative_copy, 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 "/content/drive/MyDrive/ComfyUI/comfy/samplers.py", line 785, 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 "/content/drive/MyDrive/ComfyUI/comfy/samplers.py", line 690, in sample samples = sampler.sample(model_wrap, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "/content/drive/MyDrive/ComfyUI/comfy/samplers.py", line 630, in sample samples = getattr(k_diffusionsampling, "sample{}".format(sampler_name))(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, extra_options) File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(args, kwargs) File "/content/drive/MyDrive/ComfyUI/comfy/k_diffusion/sampling.py", line 613, in sample_dpmpp_2m_sde denoised = model(x, sigmas[i] * s_in, *extra_args) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, kwargs) File "/content/drive/MyDrive/ComfyUI/comfy/samplers.py", line 323, in forward out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, cond_concat=cond_concat, model_options=model_options, seed=seed) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(args, kwargs) File "/content/drive/MyDrive/ComfyUI/comfy/k_diffusion/external.py", line 125, in forward eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), *kwargs) File "/content/drive/MyDrive/ComfyUI/comfy/k_diffusion/external.py", line 151, in get_eps return self.inner_model.apply_model(args, **kwargs) File "/content/drive/MyDrive/ComfyUI/comfy/samplers.py", line 311, in apply_model out = sampling_function(self.inner_model.apply_model, x, timestep, uncond, cond, cond_scale, cond_concat, model_options=model_options, seed=seed) File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 537, in sliding_sampling_function cond, uncond = calc_cond_uncond_batch(model_function, cond, uncond, x, timestep, max_total_area, cond_concat, model_options) File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 410, in calc_cond_uncond_batch c['control'] = control.get_control(inputx, timestep, c, len(cond_or_uncond)) File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet-main/control/control.py", line 359, in get_control_inject if self.strength == 0.0 or self.current_timestep_keyframe.strength == 0.0: AttributeError: 'NoneType' object has no attribute 'strength'

Kosinkadink commented 7 months ago

Can you send a screenshot of what the controlnet nodes look like in your workflow? And a screenshot of the entirety of the contents of your custom_nodes folder in ComfyUI?

Kosinkadink commented 7 months ago

And if you can provide your while workflow too, that would be very helpful as well

xliry commented 7 months ago

And if you can provide your while workflow too, that would be very helpful as well

My workflow is inner reflection vid2vid multi cn zombie.json here is ss error with advanced load controlnet githubcn githubcn2

here is screen shot Ksampler working well with Load controlnet Model. githubcn3

xliry commented 7 months ago

Can you send a screenshot of what the controlnet nodes look like in your workflow? And a screenshot of the entirety of the contents of your custom_nodes folder in ComfyUI?

dwdwd

Kosinkadink commented 7 months ago

@tjohn88 is having the same issue, but I can't replicate the issue using either of the workflows you guys provided, using the same exact ControlNets you are using. For the sake of a sanity check, can you update your ComfyUI, Advanced-ControlNet, and AnimateDiff-Evolved? I don't think that will fix it, but just want to make sure, so please make sure to try anyway so that we don't end up going through the trouble of finding a bug that is just an update issue. It might even be fixed if you delete the nodes and place in new ones.

Seems to be a rare bug, since I've only gotten these two reports about it in the past 5ish days that this new update has been live, so I'd like to fix it properly. I am going to make a branch of code in a bit to help debug the issue specifically for you two so that we can track down exactly what the problem is. Please keep me posted about the things you try - does this happen always, or only on the first run? Did it work at some point after the update, but does not work on subsequent runs? Anything you think might be relevant, please mention it here.

Kosinkadink commented 7 months ago

With the help of @xliry trying out the bughunt branch with logging, the issue is: your ComfyUI is badly outdated (1 month+). Whatever you're doing to update ComfyUI is not working, maybe silently failing due to a git file issue - in which case, reinstall your ComfyUI if you can't get it to update properly. ComfyUI changed how it handles percent to timestep conversion, flipping it around and using sigmas in the past month, so it is not compatible with the new code. The start_percent 0 is treated as start_percent 1 in the old ComfyUI, making it never select a timestep keyframe, meaning it is None when it tries to pull the strength from it.

Use an updated version of ComfyUI, and your issue will go away.

Kosinkadink commented 7 months ago

@tjohn88 we found the issue and fix - your ComfyUI is badly outdated by over a month, if you've already tried updating ComfyUI, the update failed and you're still on an old version of ComfyUI. Reinstalling should solve that if you were not able to update. More details above in this chain.

tjohn88 commented 7 months ago

@tjohn88 we found the issue and fix - your ComfyUI is badly outdated by over a month, if you've already tried updating ComfyUI, the update failed and you're still on an old version of ComfyUI. Reinstalling should solve that if you were not able to update. More details above in this chain.

Yes. Update of all ComfyUI helps me now. Thank you!