Added option to use unmasked conditioning image.

This commit is contained in:
random_thoughtss 2022-10-25 11:14:12 -07:00
parent 3e15f8e0f5
commit f9549d1cbb
2 changed files with 6 additions and 1 deletions

View File

@ -768,7 +768,11 @@ 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 * (1.0 - conditioning_mask)
conditioning_image = image
if shared.opts.inpainting_mask_image:
conditioning_image = conditioning_image * (1.0 - conditioning_mask)
conditioning_image = self.sd_model.get_first_stage_encoding(self.sd_model.encode_first_stage(conditioning_image))
# Create the concatenated conditioning tensor to be fed to `c_concat`

View File

@ -320,6 +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."),
}))