mcmonkeyprojects / sd-dynamic-thresholding

Dynamic Thresholding (CFG Scale Fix) for Stable Diffusion (eSwarmUI, ComfyUI, and Auto WebUI)
MIT License
1.1k stars 103 forks source link

Error with vladmandic repo #85

Closed CharlesCato closed 9 months ago

CharlesCato commented 9 months ago

I'll post the same issue in vlad side and link it back it after. EDIT: https://github.com/vladmandic/automatic/issues/2596 Well, when I try to gen with dynamic thresholding enabled I have this error and the generation stops (it was working yesterday, strangely. I didn't change any settings).

14:08:51-057313 ERROR    gradio call: AttributeError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\modules\call_queue.py:31 in f                                │
│                                                                                                                     │
│   30 │   │   │   try:                                                                                               │
│ > 31 │   │   │   │   res = func(*args, **kwargs)                                                                    │
│   32 │   │   │   │   progress.record_results(id_task, res)                                                          │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\modules\txt2img.py:69 in txt2img                             │
│                                                                                                                     │
│   68 │   if processed is None:                                                                                      │
│ > 69 │   │   processed = processing.process_images(p)                                                               │
│   70 │   p.close()                                                                                                  │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\modules\processing.py:734 in process_images                  │
│                                                                                                                     │
│    733 │   │   │   with context_hypertile_vae(p), context_hypertile_unet(p):                                        │
│ >  734 │   │   │   │   res = process_images_inner(p)                                                                │
│    735                                                                                                              │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\extensions-builtin\sd-webui-controlnet\scripts\batch_hijack. │
│ py:42 in processing_process_images_hijack                                                                           │
│                                                                                                                     │
│    41 │   │   │   # we are not in batch mode, fallback to original function                                         │
│ >  42 │   │   │   return getattr(processing, '__controlnet_original_process_images_inner')(p,                       │
│    43                                                                                                               │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\modules\processing.py:864 in process_images_inner            │
│                                                                                                                     │
│    863 │   │   │   │   with devices.without_autocast() if devices.unet_needs_upcast else device                     │
│ >  864 │   │   │   │   │   samples_ddim = p.sample(conditioning=c, unconditional_conditioning=u                     │
│    865 │   │   │   │   x_samples_ddim = [decode_first_stage(p.sd_model, samples_ddim[i:i+1].to(                     │
│                                                                                                                     │
│                                               ... 5 frames hidden ...                                               │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\modules\k-diffusion\k_diffusion\sampling.py:169 in           │
│ sample_heun                                                                                                         │
│                                                                                                                     │
│   168 │   │   │   x = x + eps * (sigma_hat ** 2 - sigmas[i] ** 2) ** 0.5                                            │
│ > 169 │   │   denoised = model(x, sigma_hat * s_in, **extra_args)                                                   │
│   170 │   │   d = to_d(x, sigma_hat, denoised)                                                                      │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\venv\lib\site-packages\torch\nn\modules\module.py:1501 in    │
│ _call_impl                                                                                                          │
│                                                                                                                     │
│   1500 │   │   │   │   or _global_forward_hooks or _global_forward_pre_hooks):                                      │
│ > 1501 │   │   │   return forward_call(*args, **kwargs)                                                             │
│   1502 │   │   # Do not call functions when jit is used                                                             │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\modules\sd_samplers_kdiffusion.py:192 in forward             │
│                                                                                                                     │
│   191 │   │   else:                                                                                                 │
│ > 192 │   │   │   denoised = self.combine_denoised(x_out, conds_list, uncond, cond_scale)                           │
│   193 │   │   if self.mask is not None:                                                                             │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\extensions-builtin\sd-dynamic-thresholding\scripts\dynamic_t │
│ hresholding.py:215 in combine_denoised                                                                              │
│                                                                                                                     │
│   214 │   │   self.main_class.step = self.step                                                                      │
│ > 215 │   │   if self.total_steps:                                                                                  │
│   216 │   │   │   self.main_class.max_steps = self.total_steps                                                      │
│                                                                                                                     │
│ D:\StableAMD\stable-diffusion-webui-directml\automatic\venv\lib\site-packages\torch\nn\modules\module.py:1614 in    │
│ __getattr__                                                                                                         │
│                                                                                                                     │
│   1613 │   │   │   │   return modules[name]                                                                         │
│ > 1614 │   │   raise AttributeError("'{}' object has no attribute '{}'".format(                                     │
│   1615 │   │   │   type(self).__name__, name))                                                                      │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: 'CustomCFGDenoiser' object has no attribute 'total_steps'
14:09:11-491406 INFO     Extensions update check: update=25 disabled=26
mcmonkey4eva commented 9 months ago

Yeahp, bad fix attempt for other issue - it's removed, update again and you'll be good

CharlesCato commented 9 months ago

Alright, seems ok now ! thanks.