ComfyUI
ComfyUI copied to clipboard
Unable to run KSampler after Inpaint, AttributeError: 'NoneType' object has no attribute 'shape'
It seems that inpainting with KSampler causes something from the mask to get "left over" into the latent output from KSampler. Running another KSampler on the output then breaks with AttributeError: 'NoneType' object has no attribute 'shape'
.
Is there any way to remove mask after inpainting?
Here is an image of how I was trying to remove mask after inpainting, but it didn't help, still getting the error.
As another workaround, I also tried to use the Remove Noise Mask
node from ImpactPack, but that didn't work either.
ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
File "C:\Programs\ComfyUI\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Programs\ComfyUI\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Programs\ComfyUI\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Programs\ComfyUI\ComfyUI\nodes.py", line 1375, in sample
return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Programs\ComfyUI\ComfyUI\nodes.py", line 1345, in common_ksampler
samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Programs\ComfyUI\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 "C:\Programs\ComfyUI\ComfyUI\comfy\samplers.py", line 712, 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 "C:\Programs\ComfyUI\ComfyUI\comfy\samplers.py", line 602, in sample
positive = encode_model_conds(model.extra_conds, positive, noise, device, "positive", latent_image=latent_image, denoise_mask=denoise_mask, seed=seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Programs\ComfyUI\ComfyUI\comfy\samplers.py", line 498, in encode_model_conds
out = model_function(**params)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Programs\ComfyUI\ComfyUI\comfy\model_base.py", line 117, in extra_conds
if len(denoise_mask.shape) == len(noise.shape):
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
The issue might be due to this commit; Add InpaintModelConditioning node.
the inpaint model fails when generating images from text. Let's wait for the author to fix it.
Of course, if you are in a hurry, you can wrap the code between lines 112 and 123 with a conditional statement to avoid the error:
if denoise_mask is not None and noise is not None:
@HelloClyde Thank you for provided the code snippet I needed to fix this! Have you notified the developer about this simple fix?
@HelloClyde Thank you for provided the code snippet I needed to fix this! Have you notified the developer about this simple fix?
@comfyanonymous Can you help with a quick fix for this issue?
The issue might be due to this commit; Add InpaintModelConditioning node.
the inpaint model fails when generating images from text. Let's wait for the author to fix it.
Of course, if you are in a hurry, you can wrap the code between lines 112 and 123 with a conditional statement to avoid the error:
if denoise_mask is not None and noise is not None:
This solution worked for me. Thanks.
The issue might be due to this commit; Add InpaintModelConditioning node.
the inpaint model fails when generating images from text. Let's wait for the author to fix it.
Of course, if you are in a hurry, you can wrap the code between lines 112 and 123 with a conditional statement to avoid the error:
if denoise_mask is not None and noise is not None:
The lines needed to be changed every update are now between lines 117 to 129 and will continue to change so remember the block the if statement need to contain has the first line: if concat_latent_image.shape[1:] != noise.shape[1:]:
and last line: denoise_mask = utils.resize_to_batch_size(denoise_mask.round(), noise.shape[0])
@comfyanonymous seems that this problem has not been fixed yet?
The author has already fixed this issue. You just need to update your version of ComfyUI to the commit "94a5a67" or later.
The author has already fixed this issue.
Thanks for the heads up. I didn't test it myself but I'll take your word for it and close this.
I am the latest version, but I still have this issue
I am the latest version, but I still have this issue
Me too
the same here :)
same here
Can you see if it's fixed with the latest commits?
yes, now is working for me 👏🏼