Add noisy latent to ExtraNoiseParams for callback
This commit is contained in:
parent
04b90328c0
commit
549b475be9
|
@ -29,12 +29,15 @@ class ImageSaveParams:
|
||||||
|
|
||||||
|
|
||||||
class ExtraNoiseParams:
|
class ExtraNoiseParams:
|
||||||
def __init__(self, noise, x):
|
def __init__(self, noise, x, xi):
|
||||||
self.noise = noise
|
self.noise = noise
|
||||||
"""Random noise generated by the seed"""
|
"""Random noise generated by the seed"""
|
||||||
|
|
||||||
self.x = x
|
self.x = x
|
||||||
"""Latent image representation of the image"""
|
"""Latent representation of the image"""
|
||||||
|
|
||||||
|
self.xi = xi
|
||||||
|
"""Noisy latent representation of the image"""
|
||||||
|
|
||||||
|
|
||||||
class CFGDenoiserParams:
|
class CFGDenoiserParams:
|
||||||
|
|
|
@ -148,7 +148,7 @@ class KDiffusionSampler(sd_samplers_common.Sampler):
|
||||||
|
|
||||||
if opts.img2img_extra_noise > 0:
|
if opts.img2img_extra_noise > 0:
|
||||||
p.extra_generation_params["Extra noise"] = opts.img2img_extra_noise
|
p.extra_generation_params["Extra noise"] = opts.img2img_extra_noise
|
||||||
extra_noise_params = ExtraNoiseParams(noise, x)
|
extra_noise_params = ExtraNoiseParams(noise, x, xi)
|
||||||
extra_noise_callback(extra_noise_params)
|
extra_noise_callback(extra_noise_params)
|
||||||
noise = extra_noise_params.noise
|
noise = extra_noise_params.noise
|
||||||
xi += noise * opts.img2img_extra_noise
|
xi += noise * opts.img2img_extra_noise
|
||||||
|
|
|
@ -107,7 +107,7 @@ class CompVisSampler(sd_samplers_common.Sampler):
|
||||||
|
|
||||||
if opts.img2img_extra_noise > 0:
|
if opts.img2img_extra_noise > 0:
|
||||||
p.extra_generation_params["Extra noise"] = opts.img2img_extra_noise
|
p.extra_generation_params["Extra noise"] = opts.img2img_extra_noise
|
||||||
extra_noise_params = ExtraNoiseParams(noise, x)
|
extra_noise_params = ExtraNoiseParams(noise, x, xi)
|
||||||
extra_noise_callback(extra_noise_params)
|
extra_noise_callback(extra_noise_params)
|
||||||
noise = extra_noise_params.noise
|
noise = extra_noise_params.noise
|
||||||
xi += noise * opts.img2img_extra_noise * sqrt_alpha_cumprod
|
xi += noise * opts.img2img_extra_noise * sqrt_alpha_cumprod
|
||||||
|
|
Loading…
Reference in New Issue