Switch to a continous blend for cond. image.
This commit is contained in:
parent
605d27687f
commit
8b4f32779f
|
@ -769,9 +769,12 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
|
|||
# Create another latent image, this time with a masked version of the original input.
|
||||
conditioning_mask = conditioning_mask.to(image.device)
|
||||
|
||||
conditioning_image = image
|
||||
if getattr(self, "inpainting_mask_image", shared.opts.inpainting_mask_image):
|
||||
conditioning_image = conditioning_image * (1.0 - conditioning_mask)
|
||||
# Smoothly interpolate between the masked and unmasked latent conditioning image.
|
||||
conditioning_image = torch.lerp(
|
||||
image,
|
||||
image * (1.0 - conditioning_mask),
|
||||
getattr(self, "inpainting_mask_weight", shared.opts.inpainting_mask_weight)
|
||||
)
|
||||
|
||||
conditioning_image = self.sd_model.get_first_stage_encoding(self.sd_model.encode_first_stage(conditioning_image))
|
||||
|
||||
|
|
|
@ -320,7 +320,7 @@ options_templates.update(options_section(('sampler-params', "Sampler parameters"
|
|||
's_tmin': OptionInfo(0.0, "sigma tmin", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
|
||||
's_noise': OptionInfo(1.0, "sigma noise", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
|
||||
'eta_noise_seed_delta': OptionInfo(0, "Eta noise seed delta", gr.Number, {"precision": 0}),
|
||||
"inpainting_mask_image": OptionInfo(True, "Mask original image for conditioning used by inpainting model."),
|
||||
"inpainting_mask_weight": OptionInfo(1.0, "Blend betweeen an unmasked and masked conditioning image for inpainting models.", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
|
||||
}))
|
||||
|
||||
|
||||
|
|
|
@ -153,9 +153,6 @@ def str_permutations(x):
|
|||
"""dummy function for specifying it in AxisOption's type when you want to get a list of permutations"""
|
||||
return x
|
||||
|
||||
def str_to_bool(x):
|
||||
return "true" in x.lower().strip()
|
||||
|
||||
AxisOption = namedtuple("AxisOption", ["label", "type", "apply", "format_value", "confirm"])
|
||||
AxisOptionImg2Img = namedtuple("AxisOptionImg2Img", ["label", "type", "apply", "format_value", "confirm"])
|
||||
|
||||
|
@ -180,7 +177,7 @@ axis_options = [
|
|||
AxisOption("Eta", float, apply_field("eta"), format_value_add_label, None),
|
||||
AxisOption("Clip skip", int, apply_clip_skip, format_value_add_label, None),
|
||||
AxisOption("Denoising", float, apply_field("denoising_strength"), format_value_add_label, None),
|
||||
AxisOption("Mask Conditioning Image", str_to_bool, apply_field("inpainting_mask_image"), format_value_add_label, None),
|
||||
AxisOption("Cond. Image Mask Weight", float, apply_field("inpainting_mask_weight"), format_value_add_label, None),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user