blenderneko / comfyui_noise Goto Github PK
View Code? Open in Web Editor NEW6 nodes for ComfyUI that allows for more control and flexibility over noise to do e.g. variations or "un-sampling"
License: GNU General Public License v3.0
6 nodes for ComfyUI that allows for more control and flexibility over noise to do e.g. variations or "un-sampling"
License: GNU General Public License v3.0
I seem to be getting this error when trying use the unsampler, sometimes i get something similar at the KSampler after Unsampler Step.
Could it be because I'm using webp as image source?
this is the workflow screenshot
ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
File "ComfyUi/ComfyUI/execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/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 "ComfyUi/ComfyUI/execution.py", line 76, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/custom_nodes/ComfyUI_Noise/nodes.py", line 236, in unsampler
samples = sampler.sample(noise, positive, negative, cfg=cfg, latent_image=latent_image, force_full_denoise=False, denoise_mask=noise_mask, sigmas=sigmas, start_step=0, last_step=end_at_step, callback=callback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/samplers.py", line 716, 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/ComfyUI/comfy/samplers.py", line 622, in sample
samples = sampler.sample(model_wrap, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/samplers.py", line 561, in sample
samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/k_diffusion/sampling.py", line 137, in sample_euler
denoised = model(x, sigma_hat * s_in, **extra_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/samplers.py", line 285, in forward
out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, model_options=model_options, seed=seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/samplers.py", line 275, in forward
return self.apply_model(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/samplers.py", line 272, in apply_model
out = sampling_function(self.inner_model, x, timestep, uncond, cond, cond_scale, model_options=model_options, seed=seed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/samplers.py", line 252, in sampling_function
cond_pred, uncond_pred = calc_cond_uncond_batch(model, cond, uncond_, x, timestep, model_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/samplers.py", line 226, in calc_cond_uncond_batch
output = model.apply_model(input_x, timestep_, **c).chunk(batch_chunks)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/model_base.py", line 85, in apply_model
model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds).float()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/ldm/modules/diffusionmodules/openaimodel.py", line 854, in forward
h = forward_timestep_embed(module, h, emb, context, transformer_options, time_context=time_context, num_video_frames=num_video_frames, image_only_indicator=image_only_indicator)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/ldm/modules/diffusionmodules/openaimodel.py", line 46, in forward_timestep_embed
x = layer(x, context, transformer_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/ldm/modules/attention.py", line 604, in forward
x = block(x, context=context[i], transformer_options=transformer_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/ldm/modules/attention.py", line 431, in forward
return checkpoint(self._forward, (x, context, transformer_options), self.parameters(), self.checkpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/ldm/modules/diffusionmodules/util.py", line 189, in checkpoint
return func(*inputs)
^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/ldm/modules/attention.py", line 491, in _forward
n = self.attn1(n, context=context_attn1, value=value_attn1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "python/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/ldm/modules/attention.py", line 383, in forward
out = optimized_attention(q, k, v, self.heads)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "ComfyUi/ComfyUI/comfy/ldm/modules/attention.py", line 318, in attention_pytorch
out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask, dropout_p=0.0, is_causal=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Invalid buffer size: 14.58 GB
Error occurred when executing BNK_GetSigma:
'SDXL' object has no attribute 'get_model_object'
Thanks for making such a useful tool, but for some reason it doesn't work for me. I followed the workflow exactly, even looking at youtube videos, but for some reason using the unsampler always leads to a black image for me. I'd be very thankful if anyone can help.
Unsampler is no longer valid Request repair
Hi, thanks for the good work done here.
I was testing unsample and noticed the latest comfy broke it
the following
def batch_area_memory(area): if xformers_enabled() or pytorch_attention_flash_attention(): #TODO: these formulas are copied from maximum_batch_area below return (area / 20) * (1024 * 1024) else: return (((area * 0.6) / 0.9) + 1024) * (1024 * 1024)
seems is removed/renamed in from comfy with commit dd4ba68b6e93a562d9499eff34e50dbbbc8714e7
but it's referenced at
nodes.py line 225
comfy.model_management.load_models_gpu([model] + models, comfy.model_management.batch_area_memory(noise.shape[0] * noise.shape[2] * noise.shape[3]) + inference_memory)
putting it back in comfy fixes it.
maybe there is a different funciton for the same.
Regards
With the ever growing custom nodes that are being released, it gets quite hard to find specific nodes when they are just added to a existing menu point. Would be awesome if you could put in a menu point "BlenderNeko" or similar, then add your nodes in there, so they are easier to find.
Hey there,
this change to samply.py broke the Unsampler node:
comfyanonymous/ComfyUI@036f88c#diff-2e28093f5c1fe698e3f531ad59f86e68cb6947e7c94f9ce142d2ae6ce0fd7506R44
We now need to call convert_cond(positive) / convert_cond(negative) here:
https://github.com/BlenderNeko/ComfyUI_Noise/blob/master/nodes.py#L221
Unsampler was broken in the following comfyui commit by the removal of the batch_area_memory method
comfyanonymous/ComfyUI@dd4ba68
The removed method is called here
Line 225 in a8c9972
Switching out the old call for the new one seems to work for me
comfy.model_management.load_models_gpu([model] + models, model.memory_required(noise.shape) + inference_memory)
Unsampler breaks when using samplers other than dpmpp_2m
Inject noise makes the latent grey outside the mask, is that how it suppose to work?
Any idea why the node can't be imported? Tried through manager and manual...
I get patchy results with it (sometimes it works sometimes it doesn't) It doesn't seem to work at all with SDXL models and only with certain sampler using 1.5. When I run it I get this output.
Any ideas what this might be?
similar to a bunch of other issues:
'SDXL' object has no attribute 'get_model_object'
seems that there is a PR with a fix ready - any plans to merge it?
Hello @BlenderNeko,
I tried injecting noise created by your Noisy Latent Image
node into a KSampler (Advanced)
node and (naively?) assumed that by setting the add_noise
parameter to disabled I would be able to obtain the same effect as by using an Empty Latent Image
with add_noise
enabled (using the same seed). This is at least what logic suggests to me. To my surprise, when add_noise
is disabled, I always get the same image result, whatever Latent I use as input to the KSampler. The result seems to have no relation with what is usually generated when add_noise
is enabled and remains the same if I use different seeds in the Noisy Latent Image
. I checked the generated noise by decoding and previewing the Latent and it obviously varies.
The example you provide is making use of Inject Noise
and KSampler (Advanced)
in a manner similar to what I'm trying to achieve. Can you explain why it seems to work in one case and not the other?
comfyanonymous/ComfyUI@ddc6f12 broke Unsampler node. The load_additional_models function now requires a third parameter.
def load_additional_models(positive, negative, dtype):
The Get Sigma node is broken since one of the recent updates to ComfyUI (along with many other extensions):
comfyanonymous/ComfyUI@57753c9
Error occurred when executing BNK_GetSigma:
'BaseModel' object has no attribute 'get_model_object'
File "C:\AI\ComfyUI\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AI\ComfyUI\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 "C:\AI\ComfyUI\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AI\ComfyUI\ComfyUI\custom_nodes\ComfyUI_Noise\nodes.py", line 142, in calc_sigma
sampler = comfy.samplers.KSampler(real_model, steps=steps, device=device, sampler=sampler_name, scheduler=scheduler, denoise=1.0, model_options=model.model_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AI\ComfyUI\ComfyUI\comfy\samplers.py", line 705, in __init__
self.set_steps(steps, denoise)
File "C:\AI\ComfyUI\ComfyUI\comfy\samplers.py", line 726, in set_steps
self.sigmas = self.calculate_sigmas(steps).to(self.device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AI\ComfyUI\ComfyUI\comfy\samplers.py", line 717, in calculate_sigmas
sigmas = calculate_sigmas(self.model.get_model_object("model_sampling"), self.scheduler, steps)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AI\ComfyUI\python_embeded\Lib\site-packages\torch\nn\modules\module.py", line 1688, in __getattr__
raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
(There may be other nodes affected, but this is the one is the first I noticed.)
I tried this but the resulting image is broken。:(
Error occurred when executing BNK_Unsampler:
module 'comfy.sample' has no attribute 'convert_cond'
File "D:\AI\ComfyUI\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI\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 "D:\AI\ComfyUI\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\ComfyUI\ComfyUI\custom_nodes\ComfyUI_Noise\nodes.py", line 221, in unsampler
positive = comfy.sample.convert_cond(positive)
Unable to import comfyui noise
I'm getting this error when loading 150 frames... seems kind of excessive. Any ideas on how to fix this?
Error occurred when executing BNK_Unsampler:
Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated : 9.49 GiB
Requested : 9.89 GiB
Device limit : 23.99 GiB
Free (according to CUDA): 0 bytes
PyTorch limit (set by user-supplied memory fraction)
: 17179869184.00 GiB
File "/stable-diffusion/execution.py", line 154, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/stable-diffusion/execution.py", line 84, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/stable-diffusion/execution.py", line 77, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/stable-diffusion/custom_nodes/ComfyUI_Noise/nodes.py", line 236, in unsampler
samples = sampler.sample(noise, positive, negative, cfg=cfg, latent_image=latent_image, force_full_denoise=False, denoise_mask=noise_mask, sigmas=sigmas, start_step=0, last_step=end_at_step, callback=callback)
File "/stable-diffusion/comfy/samplers.py", line 716, 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 "/stable-diffusion/comfy/samplers.py", line 622, in sample
samples = sampler.sample(model_wrap, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar)
File "/stable-diffusion/comfy/samplers.py", line 561, in sample
samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, **self.extra_options)
File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/stable-diffusion/comfy/k_diffusion/sampling.py", line 580, in sample_dpmpp_2m
denoised = model(x, sigmas[i] * s_in, **extra_args)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/stable-diffusion/comfy/samplers.py", line 285, in forward
out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, model_options=model_options, seed=seed)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/stable-diffusion/comfy/samplers.py", line 275, in forward
return self.apply_model(*args, **kwargs)
File "/stable-diffusion/comfy/samplers.py", line 272, in apply_model
out = sampling_function(self.inner_model, x, timestep, uncond, cond, cond_scale, model_options=model_options, seed=seed)
File "/stable-diffusion/comfy/samplers.py", line 252, in sampling_function
cond_pred, uncond_pred = calc_cond_uncond_batch(model, cond, uncond_, x, timestep, model_options)
File "/stable-diffusion/comfy/samplers.py", line 226, in calc_cond_uncond_batch
output = model.apply_model(input_x, timestep_, **c).chunk(batch_chunks)
File "/stable-diffusion/comfy/model_base.py", line 85, in apply_model
model_output = self.diffusion_model(xc, t, context=context, control=control, transformer_options=transformer_options, **extra_conds).float()
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/stable-diffusion/custom_nodes/SeargeSDXL/modules/custom_sdxl_ksampler.py", line 70, in new_unet_forward
x0 = old_unet_forward(self, x, timesteps, context, y, control, transformer_options, **kwargs)
File "/stable-diffusion/comfy/ldm/modules/diffusionmodules/openaimodel.py", line 854, in forward
h = forward_timestep_embed(module, h, emb, context, transformer_options, time_context=time_context, num_video_frames=num_video_frames, image_only_indicator=image_only_indicator)
File "/stable-diffusion/comfy/ldm/modules/diffusionmodules/openaimodel.py", line 46, in forward_timestep_embed
x = layer(x, context, transformer_options)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/stable-diffusion/comfy/ldm/modules/attention.py", line 604, in forward
x = block(x, context=context[i], transformer_options=transformer_options)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/stable-diffusion/comfy/ldm/modules/attention.py", line 431, in forward
return checkpoint(self._forward, (x, context, transformer_options), self.parameters(), self.checkpoint)
File "/stable-diffusion/comfy/ldm/modules/diffusionmodules/util.py", line 189, in checkpoint
return func(*inputs)
File "/stable-diffusion/comfy/ldm/modules/attention.py", line 541, in _forward
x = self.ff(self.norm3(x))
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/stable-diffusion/comfy/ldm/modules/attention.py", line 85, in forward
return self.net(x)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/container.py", line 215, in forward
input = module(input)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/stable-diffusion/comfy/ldm/modules/attention.py", line 64, in forward
x, gate = self.proj(x).chunk(2, dim=-1)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, **kwargs)
File "/stable-diffusion/comfy/ops.py", line 28, in forward
return super().forward(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/linear.py", line 114, in forward
return F.linear(input, self.weight, self.bias)
Error occurred when executing BNK_Unsampler:
module 'comfy.sample' has no attribute 'convert_cond'
File "D:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\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 "D:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\new_ComfyUI_windows_portable_nvidia_cu121_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Noise\nodes.py", line 221, in unsampler
positive = comfy.sample.convert_cond(positive)
^^^^^^^^^^^^^^^^^^^^^^^^^
when two noises are equal their dot product will be 1, resulting in so==0
and a divide by zero
Hello BlenderNeko,
I encountered a problem with the unsample node, I followed the example you gave in example_unsample.png, but I didn't get the same image after unsampling and sampling.
Here's
We ever spoke. I was using your nodes to work on a video workflow and inject diffusion partly from frame -1 (unsampled) into frame 1 (for consistency improvement). And you told me there where a problem with the unsample; maybe it's the same thing?
Thank you !
I'm working on support for DemoFusion (an upscaling technique), which requires getting the full sequence of progressively noised latents. I added batching to the unsampler in ComfyUI_Noise to create the "Batch Unsampler" node. It's exactly the same as the Unsampler, but outputs all the intermediate steps. The intermediate steps are taken in the callback function during sampling.
https://gist.github.com/ttulttul/2b09f0f14bb35639ada7ed37b1f0428d
I'd love your feedback, @BlenderNeko. One thing I observe is that the initial latents in the batch seem a little de-contrasted. I wonder if that's because they need to be normalized in order to look "right". But of course in the present case, we don't want to normalize anything.
Hello,
I was wondering if it would be possible to add a similar option to your unsampler node as the Auto1111 script has with it's "sigma corrected noise"
This substantially improves the output and looking over the code it shouldn't be that difficult to implement (hopefully).
I use your nodes a lot. There are many applications for both of your example workflows "generating variations" and "unsampling". I really would like to combine both of these workflows to start with an image, unsample to get noise that relates to the original image (1x), duplicate the output of the unsampler (8x), generate different latent noise vectors (8x), slerp the two together, run them through the ksampler, get 8 different images that all relate to the original images with some variety, pick the best looking image.
If I put the slerp factor to 1.00 (discard the output of the unsampler) it correctly generates 8x images that have no relation with the original image:
Any other slerp factor that gives some positive weight to the output of the unsampler returns 8 identical noisy outputs:
If I remove the latent noise/slerp/noise inject the workflow functions as expected:
The reason I want to do this is to get a lot more control over inpainting, which is in my experience a weakness of comfyui. I would expect this to work. Is this idea even possible? Is the execution wrong?
I got this error when trying to install the nodes:
Traceback (most recent call last):
File "C:\Apps\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1888, in load_custom_node
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Apps\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Noise\__init__.py", line 1, in <module>
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "C:\Apps\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Noise\nodes.py", line 10, in <module>
import comfy.sampler_helpers
ModuleNotFoundError: No module named 'comfy.sampler_helpers'
Cannot import C:\Apps\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Noise module for custom nodes: No module named 'comfy.sampler_helpers'
To be fair, I've been having similar issues trying to install other nodes recently.
Hello
Can the unsampler work with SDXL? I can only make it work with SD1.5. Many thanks for these fantastic tools.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.