diff --git a/CHANGELOG.md b/CHANGELOG.md index 1da9d4962..39df3abc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,7 @@ - fix wildcards folders traversal, thanks @dymil - fix zluda flash attention with enable_gqa - fix `wan a14b` quantization + - fix reprocess workflow for control with hires ## Update for 2025-08-20 diff --git a/javascript/black-teal-reimagined.css b/javascript/black-teal-reimagined.css index dc3d4d0ce..6f6b7e24e 100644 --- a/javascript/black-teal-reimagined.css +++ b/javascript/black-teal-reimagined.css @@ -932,7 +932,7 @@ svg.feather.feather-image, .extra-network-cards .card .version { position: absolute; top: 0; - left: 0; + right: 0; padding: 2px; font-weight: bolder; text-shadow: 1px 1px black; diff --git a/javascript/sdnext.css b/javascript/sdnext.css index 5c29863ab..7bae7307c 100644 --- a/javascript/sdnext.css +++ b/javascript/sdnext.css @@ -1357,7 +1357,7 @@ table.settings-value-table td { .extra-network-cards .card .version { background: gray; font-weight: bolder; - left: 0; + right: 0; line-height: 0.9rem; margin: 4px; opacity: 75%; diff --git a/modules/control/run.py b/modules/control/run.py index bc25d27bb..8ecf05013 100644 --- a/modules/control/run.py +++ b/modules/control/run.py @@ -269,6 +269,8 @@ def control_run(state: str = '', # pylint: disable=keyword-arg-before-vararg *input_script_args, ): global pipe, original_pipeline # pylint: disable=global-statement + if 'refine' in state: + enable_hr = True unit.current = units debug_log(f'Control: type={unit_type} input={inputs} init={inits} type={input_type}') diff --git a/modules/processing_class.py b/modules/processing_class.py index 8b02e38aa..f963b735c 100644 --- a/modules/processing_class.py +++ b/modules/processing_class.py @@ -368,8 +368,8 @@ class StableDiffusionProcessing: shared.opts.sd_model_checkpoint = sd_model_checkpoint sd_models.reload_model_weights() - def __str__(self): - return f'{self.__class__.__name__}: {self.__dict__}' + def __repr__(self): + return f'{self.__class__.__name__}({", ".join([f"{k}={v}" for k, v in self.__dict__.items() if k not in ["scripts_value", "script_args_value"]])})' @property def sd_model(self): @@ -557,15 +557,17 @@ class StableDiffusionProcessingControl(StableDiffusionProcessingImg2Img): debug(f'Process init: mode={self.__class__.__name__} kwargs={kwargs}') # pylint: disable=protected-access super().__init__(**kwargs) - def init_hr(self, scale = None, upscaler = None, force = False): - scale = scale or self.scale_by - upscaler = upscaler or self.resize_name + def init_hr(self, scale:float=None, upscaler:str=None, force:bool=False): + scale = scale or self.scale_by or self.scale_by_before + upscaler = upscaler or self.hr_upscaler or self.resize_name or self.resize_name_before + if upscaler is None: + upscaler = 'None' + # self.hr_upscaler = upscaler or 'None' use_scale = self.hr_resize_x == 0 or self.hr_resize_y == 0 if upscaler == 'None' or (use_scale and scale == 1.0): return self.is_hr_pass = True self.hr_force = force - self.hr_upscaler = upscaler if use_scale: vae_scale_factor = sd_vae.get_vae_scale_factor() self.hr_upscale_to_x, self.hr_upscale_to_y = vae_scale_factor * int(self.width * scale / vae_scale_factor), vae_scale_factor * int(self.height * scale / vae_scale_factor) diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index d31732528..9c4ec0ec8 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -33,17 +33,32 @@ def restore_state(p: processing.StableDiffusionProcessing): # set ops if state == 'reprocess_refine': - # use new upscale values - hr_scale, hr_upscaler, hr_resize_mode, hr_resize_context, hr_resize_x, hr_resize_y, hr_upscale_to_x, hr_upscale_to_y = p.hr_scale, p.hr_upscaler, p.hr_resize_mode, p.hr_resize_context, p.hr_resize_x, p.hr_resize_y, p.hr_upscale_to_x, p.hr_upscale_to_y # txt2img - height, width, scale_by, resize_mode, resize_name, resize_context = p.height, p.width, p.scale_by, p.resize_mode, p.resize_name, p.resize_context # img2img + width, width_before, width_after, width_mask = p.width, p.width_before, p.width_after, p.width_mask + height, height_before, height_after, height_mask = p.height, p.height_before, p.height_after, p.height_mask + scale_by, scale_by_before, scale_by_after, scale_by_mask = p.scale_by, p.scale_by_before, p.scale_by_after, p.scale_by_mask + resize_name, resize_name_before, resize_name_after, resize_name_mask = p.resize_name, p.resize_name_before, p.resize_name_after, p.resize_name_mask + resize_mode, resize_mode_before, resize_mode_after, resize_mode_mask = p.resize_mode, p.resize_mode_before, p.resize_mode_after, p.resize_mode_mask + resize_context, resize_context_before, resize_context_after, resize_context_mask = p.resize_context, p.resize_context_before, p.resize_context_after, p.resize_context_mask + selected_scale_tab, selected_scale_tab_before, selected_scale_tab_after, selected_scale_tab_mask = p.selected_scale_tab, p.selected_scale_tab_before, p.selected_scale_tab_after, p.selected_scale_tab_mask + hr_scale, hr_resize_mode, hr_resize_context, hr_upscaler, hr_second_pass_steps = p.hr_scale, p.hr_resize_mode, p.hr_resize_context, p.hr_upscaler, p.hr_second_pass_steps + hr_resize_x, hr_resize_y, hr_upscale_to_x, hr_upscale_to_y, hr_denoising_strength = p.hr_resize_x, p.hr_resize_y, p.hr_upscale_to_x, p.hr_upscale_to_y, p.hr_denoising_strength + p = last_p p.skip = ['encode', 'base'] p.state = state p.enable_hr = True p.hr_force = True - p.hr_scale, p.hr_upscaler, p.hr_resize_mode, p.hr_resize_context, p.hr_resize_x, p.hr_resize_y, p.hr_upscale_to_x, p.hr_upscale_to_y = hr_scale, hr_upscaler, hr_resize_mode, hr_resize_context, hr_resize_x, hr_resize_y, hr_upscale_to_x, hr_upscale_to_y - p.height, p.width, p.scale_by, p.resize_mode, p.resize_name, p.resize_context = height, width, scale_by, resize_mode, resize_name, resize_context p.init_images = None + + p.width, p.width_before, p.width_after, p.width_mask = width, width_before, width_after, width_mask + p.height, p.height_before, p.height_after, p.height_mask = height, height_before, height_after, height_mask + p.resize_name, p.resize_name_before, p.resize_name_after, p.resize_name_mask = resize_name, resize_name_before, resize_name_after, resize_name_mask + p.resize_mode, p.resize_mode_before, p.resize_mode_after, p.resize_mode_mask = resize_mode, resize_mode_before, resize_mode_after, resize_mode_mask + p.resize_context, p.resize_context_before, p.resize_context_after, p.resize_context_mask = resize_context, resize_context_before, resize_context_after, resize_context_mask + p.selected_scale_tab, p.selected_scale_tab_before, p.selected_scale_tab_after, p.selected_scale_tab_mask = selected_scale_tab, selected_scale_tab_before, selected_scale_tab_after, selected_scale_tab_mask + p.scale_by, p.scale_by_before, p.scale_by_after, p.scale_by_mask = scale_by, scale_by_before, scale_by_after, scale_by_mask + p.hr_scale, p.hr_resize_mode, p.hr_resize_context, p.hr_upscaler, p.hr_second_pass_steps = hr_scale, hr_resize_mode, hr_resize_context, hr_upscaler, hr_second_pass_steps + p.hr_resize_x, p.hr_resize_y, p.hr_upscale_to_x, p.hr_upscale_to_y, p.hr_denoising_strength = hr_resize_x, hr_resize_y, hr_upscale_to_x, hr_upscale_to_y, hr_denoising_strength if state == 'reprocess_detail': p.skip = ['encode', 'base', 'hires'] p.detailer_enabled = True