sd-webui-cads icon indicating copy to clipboard operation
sd-webui-cads copied to clipboard

ControlNet - NansException

Open matrix4767 opened this issue 2 years ago • 4 comments
trafficstars

Trying to use this extension with reference only controlnet enabled led to this error. Said error then happens even after the extension is disabled. You would need to generate something with controlnet off, in order to clear the error after enabling controlnet back on, but not CADS. Traceback (most recent call last): File "G:\stable-webui\modules\call_queue.py", line 57, in f res = list(func(*args, **kwargs)) File "G:\stable-webui\modules\call_queue.py", line 36, in f res = func(*args, **kwargs) File "G:\stable-webui\modules\txt2img.py", line 55, in txt2img processed = processing.process_images(p) File "G:\stable-webui\modules\processing.py", line 732, in process_images res = process_images_inner(p) File "G:\stable-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs) File "G:\stable-webui\modules\processing.py", line 867, in process_images_inner samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts) File "G:\stable-webui\extensions\sd-webui-controlnet\scripts\hook.py", line 451, in process_sample return process.sample_before_CN_hack(*args, **kwargs) File "G:\stable-webui\modules\processing.py", line 1140, in sample samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x)) File "G:\stable-webui\modules\sd_samplers_kdiffusion.py", line 235, in sample samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs)) File "G:\stable-webui\modules\sd_samplers_common.py", line 261, in launch_sampling return func() File "G:\stable-webui\modules\sd_samplers_kdiffusion.py", line 235, in samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs)) File "G:\stable-webui\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "G:\stable-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 594, in sample_dpmpp_2m denoised = model(x, sigmas[i] * s_in, **extra_args) File "G:\stable-webui\venv\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "G:\stable-webui\modules\sd_samplers_cfg_denoiser.py", line 201, in forward devices.test_for_nans(x_out, "unet") File "G:\stable-webui\modules\devices.py", line 136, in test_for_nans raise NansException(message) modules.devices.NansException: A tensor with all NaNs was produced in Unet. This could be either because there's not enough precision to represent the picture, or because your video card does not support half type. Try setting the "Upcast cross attention layer to float32" option in Settings > Stable Diffusion or using the --no-half commandline argument to fix this. Use --disable-nan-check commandline argument to disable this check.

matrix4767 avatar Nov 01 '23 16:11 matrix4767

Thanks for the report ~

v0xie avatar Nov 01 '23 19:11 v0xie

This is still an issue ~3 months later. I keep forgetting not to enable CAD/CN at the same time, and have to kill everything and start over.

Are there any PRs or known fixes we can integrate ourselves, while we wait for this mean bug to get squashed?

Derjyn avatar Feb 05 '24 07:02 Derjyn

@Derjyn I think I fixed it with the latest commit, let me know if it's still an issue?

v0xie avatar Feb 10 '24 19:02 v0xie

@Derjyn I think I fixed it with the latest commit, let me know if it's still an issue?

Second day of testing, and so far, no issues have arisen. Seems like you may have squashed that bug. Awesome, keep up the great work!

Derjyn avatar Feb 20 '24 02:02 Derjyn