Prompt editing only applies to images in first batch of desired batch size when batch count > 1 #535

This commit is contained in:
AUTOMATIC 2022-09-16 08:51:21 +03:00
parent b153ebe3b6
commit b44ddcb443

View file

@ -115,6 +115,7 @@ class VanillaStableDiffusionSampler:
self.mask = p.mask self.mask = p.mask
self.nmask = p.nmask self.nmask = p.nmask
self.init_latent = p.init_latent self.init_latent = p.init_latent
self.step = 0
samples = self.sampler.decode(x1, conditioning, t_enc, unconditional_guidance_scale=p.cfg_scale, unconditional_conditioning=unconditional_conditioning) samples = self.sampler.decode(x1, conditioning, t_enc, unconditional_guidance_scale=p.cfg_scale, unconditional_conditioning=unconditional_conditioning)
@ -127,6 +128,7 @@ class VanillaStableDiffusionSampler:
self.mask = None self.mask = None
self.nmask = None self.nmask = None
self.init_latent = None self.init_latent = None
self.step = 0
# existing code fails with cetin step counts, like 9 # existing code fails with cetin step counts, like 9
try: try:
@ -206,6 +208,7 @@ class KDiffusionSampler:
self.model_wrap_cfg.mask = p.mask self.model_wrap_cfg.mask = p.mask
self.model_wrap_cfg.nmask = p.nmask self.model_wrap_cfg.nmask = p.nmask
self.model_wrap_cfg.init_latent = p.init_latent self.model_wrap_cfg.init_latent = p.init_latent
self.model_wrap.step = 0
if hasattr(k_diffusion.sampling, 'trange'): if hasattr(k_diffusion.sampling, 'trange'):
k_diffusion.sampling.trange = lambda *args, **kwargs: extended_trange(*args, **kwargs) k_diffusion.sampling.trange = lambda *args, **kwargs: extended_trange(*args, **kwargs)
@ -216,6 +219,8 @@ class KDiffusionSampler:
sigmas = self.model_wrap.get_sigmas(p.steps) sigmas = self.model_wrap.get_sigmas(p.steps)
x = x * sigmas[0] x = x * sigmas[0]
self.model_wrap_cfg.step = 0
if hasattr(k_diffusion.sampling, 'trange'): if hasattr(k_diffusion.sampling, 'trange'):
k_diffusion.sampling.trange = lambda *args, **kwargs: extended_trange(*args, **kwargs) k_diffusion.sampling.trange = lambda *args, **kwargs: extended_trange(*args, **kwargs)