This commit is contained in:
Haoming 2026-01-12 10:26:58 +08:00
parent 9d964f21c8
commit bb6b1db8ed
3 changed files with 12 additions and 8 deletions

View File

@ -31,11 +31,12 @@ class ScriptMahiro(scripts.ScriptBuiltinUI):
return [enable]
def after_extra_networks_activate(self, p, enable, *args, **kwargs):
if opts.show_mahiro and enable:
if enable:
p.extra_generation_params.update({"MaHiRo": enable})
p.mahiro = True
def process_before_every_sampling(self, p, enable, *args, **kwargs):
if not opts.show_mahiro or not enable:
def process_before_every_sampling(self, p, *args, **kwargs):
if str(getattr(p, "mahiro", False)) != "True":
return
@torch.inference_mode()

View File

@ -34,19 +34,20 @@ class ScriptRescaleCFG(scripts.ScriptBuiltinUI):
return [cfg]
def after_extra_networks_activate(self, p, cfg, *args, **kwargs):
if opts.show_rescale_cfg and cfg > 0.0:
if cfg > 0.0:
p.extra_generation_params.update({"Rescale CFG": cfg})
p.rescale_cfg = cfg
def process_before_every_sampling(self, p, cfg, *args, **kwargs):
if not opts.show_rescale_cfg or cfg < 0.05:
def process_before_every_sampling(self, p, *args, **kwargs):
if getattr(p, "rescale_cfg", 0.0) < 0.05:
return
if p.is_hr_pass:
return
self.apply_rescale_cfg(p, cfg)
self.apply_rescale_cfg(p, p.rescale_cfg)
@staticmethod
def apply_rescale_cfg(p, cfg):
def apply_rescale_cfg(p, cfg: float):
@torch.inference_mode()
def rescale_cfg(args):

View File

@ -267,6 +267,8 @@ axis_options = [
AxisOptionTxt2Img("Hires steps", int, apply_field("hr_second_pass_steps")),
AxisOption("CFG Scale", float, apply_field("cfg_scale")),
AxisOption("Distilled CFG Scale", float, apply_field("distilled_cfg_scale")),
AxisOption("Rescale CFG", float, apply_field("rescale_cfg")),
AxisOption("MaHiRo", str, apply_field("mahiro"), choices=boolean_choice(reverse=True)),
AxisOptionImg2Img("Image CFG Scale", float, apply_field("image_cfg_scale")),
AxisOption("Prompt S/R", str, apply_prompt, format_value=format_value),
AxisOption("Prompt order", str_permutations, apply_order, format_value=format_value_join_list),