v0xie / sd-webui-cads

Greatly increase the diversity of your generated images in Automatic1111 WebUI through Condition-Annealed Sampling.
GNU General Public License v3.0
103 stars 6 forks source link

ControlNet - NansException #1

Open matrix4767 opened 1 year ago

matrix4767 commented 1 year ago

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.

v0xie commented 1 year ago

Thanks for the report ~

Derjyn commented 9 months ago

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?

v0xie commented 9 months ago

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

Derjyn commented 8 months ago

@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!