aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sd_samplers_cfg_denoiser.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-08 19:09:40 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-08 19:09:51 +0000
commitf8ff8c0638997fd0aef217db1505598846f14782 (patch)
treee94ba153369a657df92857b7c342d5d245a0a8b4 /modules/sd_samplers_cfg_denoiser.py
parent54c3e5c913b17622bed4ff4d03df488b80611e21 (diff)
downloadstable-diffusion-webui-gfx803-f8ff8c0638997fd0aef217db1505598846f14782.tar.gz
stable-diffusion-webui-gfx803-f8ff8c0638997fd0aef217db1505598846f14782.tar.bz2
stable-diffusion-webui-gfx803-f8ff8c0638997fd0aef217db1505598846f14782.zip
merge errors
Diffstat (limited to 'modules/sd_samplers_cfg_denoiser.py')
-rw-r--r--modules/sd_samplers_cfg_denoiser.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/modules/sd_samplers_cfg_denoiser.py b/modules/sd_samplers_cfg_denoiser.py
index d826222c..a532e013 100644
--- a/modules/sd_samplers_cfg_denoiser.py
+++ b/modules/sd_samplers_cfg_denoiser.py
@@ -38,16 +38,24 @@ class CFGDenoiser(torch.nn.Module):
negative prompt.
"""
- def __init__(self, model, sampler):
+ def __init__(self, sampler):
super().__init__()
- self.inner_model = model
+ self.model_wrap = None
self.mask = None
self.nmask = None
self.init_latent = None
+ self.steps = None
self.step = 0
self.image_cfg_scale = None
self.padded_cond_uncond = False
self.sampler = sampler
+ self.model_wrap = None
+ self.p = None
+
+ @property
+ def inner_model(self):
+ raise NotImplementedError()
+
def combine_denoised(self, x_out, conds_list, uncond, cond_scale):
denoised_uncond = x_out[-uncond.shape[0]:]
@@ -68,10 +76,21 @@ class CFGDenoiser(torch.nn.Module):
def get_pred_x0(self, x_in, x_out, sigma):
return x_out
+ def update_inner_model(self):
+ self.model_wrap = None
+
+ c, uc = self.p.get_conds()
+ self.sampler.sampler_extra_args['cond'] = c
+ self.sampler.sampler_extra_args['uncond'] = uc
+
def forward(self, x, sigma, uncond, cond, cond_scale, s_min_uncond, image_cond):
if state.interrupted or state.skipped:
raise sd_samplers_common.InterruptedException
+ if sd_samplers_common.apply_refiner(self):
+ cond = self.sampler.sampler_extra_args['cond']
+ uncond = self.sampler.sampler_extra_args['uncond']
+
# at self.image_cfg_scale == 1.0 produced results for edit model are the same as with normal sampling,
# so is_edit_model is set to False to support AND composition.
is_edit_model = shared.sd_model.cond_stage_key == "edit" and self.image_cfg_scale is not None and self.image_cfg_scale != 1.0