Hires additional modules (#2116)

adds selection of none/same/different modules for hiresfix
('Use same choices' default option has priority over other selections made at same time.)
includes saving/loading from infotext
This commit is contained in:
DenOfEquity
2024-10-21 11:03:12 +01:00
committed by GitHub
parent edc46380cc
commit aaa2fe761b
4 changed files with 71 additions and 14 deletions

View File

@@ -12,7 +12,7 @@ import gradio as gr
from modules_forge import main_thread
def txt2img_create_processing(id_task: str, request: gr.Request, prompt: str, negative_prompt: str, prompt_styles, n_iter: int, batch_size: int, cfg_scale: float, distilled_cfg_scale: float, height: int, width: int, enable_hr: bool, denoising_strength: float, hr_scale: float, hr_upscaler: str, hr_second_pass_steps: int, hr_resize_x: int, hr_resize_y: int, hr_checkpoint_name: str, hr_sampler_name: str, hr_scheduler: str, hr_prompt: str, hr_negative_prompt, hr_cfg: float, hr_distilled_cfg: float, override_settings_texts, *args, force_enable_hr=False):
def txt2img_create_processing(id_task: str, request: gr.Request, prompt: str, negative_prompt: str, prompt_styles, n_iter: int, batch_size: int, cfg_scale: float, distilled_cfg_scale: float, height: int, width: int, enable_hr: bool, denoising_strength: float, hr_scale: float, hr_upscaler: str, hr_second_pass_steps: int, hr_resize_x: int, hr_resize_y: int, hr_checkpoint_name: str, hr_additional_modules: list, hr_sampler_name: str, hr_scheduler: str, hr_prompt: str, hr_negative_prompt, hr_cfg: float, hr_distilled_cfg: float, override_settings_texts, *args, force_enable_hr=False):
override_settings = create_override_settings_dict(override_settings_texts)
if force_enable_hr:
@@ -38,6 +38,7 @@ def txt2img_create_processing(id_task: str, request: gr.Request, prompt: str, ne
hr_resize_x=hr_resize_x,
hr_resize_y=hr_resize_y,
hr_checkpoint_name=None if hr_checkpoint_name == 'Use same checkpoint' else hr_checkpoint_name,
hr_additional_modules=hr_additional_modules,
hr_sampler_name=None if hr_sampler_name == 'Use same sampler' else hr_sampler_name,
hr_scheduler=None if hr_scheduler == 'Use same scheduler' else hr_scheduler,
hr_prompt=hr_prompt,
@@ -92,7 +93,7 @@ def txt2img_upscale_function(id_task: str, request: gr.Request, gallery, gallery
p.extra_generation_params['Original Size'] = f'{args[8]}x{args[7]}'
p.override_settings['save_images_before_highres_fix'] = False
p.override_settings['sd_model_checkpoint'] = p.hr_checkpoint_name
p.highresfix_quick = True
with closing(p):
processed = modules.scripts.scripts_txt2img.run(p, *p.script_args)