From 910b88e632f00e9ffcfc3f37858ffb4ec5dca86e Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 11 Nov 2024 15:51:30 -0500 Subject: [PATCH] add refine/hires to img2img Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 2 ++ modules/control/run.py | 2 +- modules/processing_class.py | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5db77983c..f4178db22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ This release can be considered an LTS release before we kick off the next round - add show networks on startup setting - better mapping of networks previews - optimize networks display load + - Image2image: + - integrated refine/upscale/hires workflow - Other: - Installer: - Log `venv` and package search paths diff --git a/modules/control/run.py b/modules/control/run.py index 74bab35c4..d2e1b36ef 100644 --- a/modules/control/run.py +++ b/modules/control/run.py @@ -70,7 +70,7 @@ def control_run(state: str = '', enable_hr: bool = False, hr_sampler_index: int = None, hr_denoising_strength: float = 0.3, hr_resize_mode: int = 0, hr_resize_context: str = 'None', hr_upscaler: str = None, hr_force: bool = False, hr_second_pass_steps: int = 20, hr_scale: float = 1.0, hr_resize_x: int = 0, hr_resize_y: int = 0, refiner_steps: int = 5, refiner_start: float = 0.0, refiner_prompt: str = '', refiner_negative: str = '', video_skip_frames: int = 0, video_type: str = 'None', video_duration: float = 2.0, video_loop: bool = False, video_pad: int = 0, video_interpolate: int = 0, - *input_script_args + *input_script_args, ): # handle optional initialization via ui for u in units: diff --git a/modules/processing_class.py b/modules/processing_class.py index 215507b4a..333e11925 100644 --- a/modules/processing_class.py +++ b/modules/processing_class.py @@ -69,7 +69,6 @@ class StableDiffusionProcessing: hdr_tint_ratio: float = 0, # img2img init_images: list = None, - init_latent: Any = None, resize_mode: int = 0, resize_name: str = 'None', resize_context: str = 'None', @@ -80,7 +79,6 @@ class StableDiffusionProcessing: selected_scale_tab: int = 0, # pylint: disable=unused-argument # a1111 compatibility # inpaint mask: Any = None, - image_mask: Any = None, latent_mask: Any = None, mask_for_overlay: Any = None, mask_blur: int = 4, @@ -179,7 +177,7 @@ class StableDiffusionProcessing: self.image_cfg_scale = image_cfg_scale self.scale_by = scale_by self.mask = mask - self.image_mask = mask + self.image_mask = mask # TODO duplciate mask params self.latent_mask = latent_mask self.mask_blur = mask_blur self.inpainting_fill = inpainting_fill @@ -221,6 +219,7 @@ class StableDiffusionProcessing: self.mask_for_overlay = mask_for_overlay self.paste_to = paste_to self.init_latent = None + # special handled items if firstphase_width != 0 or firstphase_height != 0: self.hr_upscale_to_x = self.width @@ -238,6 +237,7 @@ class StableDiffusionProcessing: self.all_negative_prompts = None self.all_seeds = None self.all_subseeds = None + # ip adapter self.ip_adapter_names = [] self.ip_adapter_scales = [0.0] @@ -245,6 +245,7 @@ class StableDiffusionProcessing: self.ip_adapter_starts = [0.0] self.ip_adapter_ends = [1.0] self.ip_adapter_crops = [] + # a1111 compatibility items shared.opts.data['clip_skip'] = int(self.clip_skip) # for compatibility with a1111 sd_hijack_clip self.seed_enable_extras: bool = True, @@ -263,12 +264,14 @@ class StableDiffusionProcessing: self.initial_noise_multiplier = initial_noise_multiplier or shared.opts.initial_noise_multiplier self.image_conditioning = None self.prompt_for_display: str = None + # scripts self.scripts_value: scripts.ScriptRunner = field(default=None, init=False) self.script_args_value: list = field(default=None, init=False) self.scripts_setup_complete: bool = field(default=False, init=False) self.script_args = script_args self.per_script_args = {} + # settings to processing self.ddim_discretize = shared.opts.ddim_discretize self.s_min_uncond = shared.opts.s_min_uncond