Kosinkadink / ComfyUI-Advanced-ControlNet

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

AttributeError: 'ControlNetAdvanced' object has no attribute 'model_sampling_current' #22

Closed Nikki29o closed 12 months ago

Nikki29o commented 1 year ago

Does anyone have the same problem with me? sys: Linux

ERROR:root:Traceback (most recent call last): File "/ComfyUI/execution.py", line 153, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/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 "/home/data/chenyiran/ComfyUI/execution.py", line 76, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "/ComfyUI/custom_nodes/comfyui-animatediff/animatediff/sampler.py", line 295, in animatediff_sample return super().sample( File "/ComfyUI/nodes.py", line 1237, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) File "/ComfyUI/nodes.py", line 1207, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, File "/ComfyUI/comfy/sample.py", line 100, 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 "/ComfyUI/comfy/samplers.py", line 728, 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 "/ComfyUI/comfy/samplers.py", line 633, in sample samples = sampler.sample(model_wrap, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "/ComfyUI/comfy/samplers.py", line 589, 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 "/env_webui/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, kwargs) File "/ComfyUI/comfy/k_diffusion/sampling.py", line 137, in sample_euler denoised = model(x, sigma_hat * s_in, *extra_args) File "/env_webui/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(args, kwargs) File "//ComfyUI/comfy/samplers.py", line 287, in forward out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, model_options=model_options, seed=seed) File "env_webui/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, kwargs) File "/ComfyUI/comfy/k_diffusion/external.py", line 129, in forward eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), *kwargs) File "/ComfyUI/comfy/k_diffusion/external.py", line 155, in get_eps return self.inner_model.apply_model(args, kwargs) File "/ComfyUI/comfy/samplers.py", line 275, in apply_model out = sampling_function(self.inner_model.apply_model, x, timestep, uncond, cond, cond_scale, model_options=model_options, seed=seed) File "/ComfyUI/comfy/samplers.py", line 253, in sampling_function cond, uncond = calc_cond_uncond_batch(model_function, cond, uncond, x, timestep, max_total_area, model_options) File "/ComfyUI/comfy/samplers.py", line 206, in calc_cond_uncond_batch c['control'] = control.get_control(inputx, timestep, c, len(cond_or_uncond)) File "/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/control/control.py", line 185, in get_control return self.sliding_get_control(x_noisy, t, cond, batched_number) File "/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/control/control.py", line 190, in sliding_get_control control_prev = self.previous_controlnet.get_control(x_noisy, t, cond, batched_number) File "/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/control/control.py", line 185, in get_control return self.sliding_get_control(x_noisy, t, cond, batched_number) File "/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/control/control.py", line 238, in sliding_get_control timestep = self.model_sampling_current.timestep(t) AttributeError: 'ControlNetAdvanced' object has no attribute 'model_sampling_current'

Kosinkadink commented 1 year ago

You likely need to update your ComfyUI. model_samoling_current is something it inherits from the vanilla ControlNet class, and since it can't find it, that means your ComfyUI is outdated.

kingzhongmu commented 1 year ago

hello, I updated ComfyUI, but have the same error, but,I rollback to 1b8800d, and fix it。

Kosinkadink commented 1 year ago

Whatever you are doing to update ComfyUI is not working. If you update ComfyUI successfully, it will fix the issue. The line of code it is expecting to exist on ControlNet is this one: https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/controlnet.py#L135C16-L135C16

That link shows exactly where it is in current ComfyUI. Your ComfyUI does not have that because your attempt to update did not succeed. You making it work by rolling back ComfyUI-Advanced-ControlNet to a version that worked on an old version of ComfyUI is proof your ComfyUI update did not succeed, as well. If you want to update, you can run git pull in your ComfyUI directory.

Let me know if that lets you update ComfyUI successfully.