diff --git a/modules/processing_scripts/mahiro.py b/modules/processing_scripts/mahiro.py index af3567e0..7d8204aa 100644 --- a/modules/processing_scripts/mahiro.py +++ b/modules/processing_scripts/mahiro.py @@ -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() diff --git a/modules/processing_scripts/rescale_cfg.py b/modules/processing_scripts/rescale_cfg.py index a4217774..a36d1e08 100644 --- a/modules/processing_scripts/rescale_cfg.py +++ b/modules/processing_scripts/rescale_cfg.py @@ -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): diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 647ebb10..7572ac30 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -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),