diff --git a/backend/diffusion_engine/base.py b/backend/diffusion_engine/base.py index 6bff1bc2..5fedf99a 100644 --- a/backend/diffusion_engine/base.py +++ b/backend/diffusion_engine/base.py @@ -53,6 +53,7 @@ class ForgeDiffusionEngine: self.first_stage_model = None self.cond_stage_model = None self.use_distilled_cfg_scale = False + self.use_shift = False self.is_sd1 = False self.is_sdxl = False self.is_flux = False # affects the usage of TAESD diff --git a/backend/diffusion_engine/lumina.py b/backend/diffusion_engine/lumina.py index b9ec5ea1..fc8a57c2 100644 --- a/backend/diffusion_engine/lumina.py +++ b/backend/diffusion_engine/lumina.py @@ -34,6 +34,7 @@ class Lumina2(ForgeDiffusionEngine): self.forge_objects_original = self.forge_objects.shallow_copy() self.forge_objects_after_applying_lora = self.forge_objects.shallow_copy() + self.use_shift = True self.is_flux = True @torch.inference_mode() diff --git a/backend/diffusion_engine/wan.py b/backend/diffusion_engine/wan.py index 6263731a..25a62708 100644 --- a/backend/diffusion_engine/wan.py +++ b/backend/diffusion_engine/wan.py @@ -36,6 +36,7 @@ class Wan(ForgeDiffusionEngine): self.forge_objects_original = self.forge_objects.shallow_copy() self.forge_objects_after_applying_lora = self.forge_objects.shallow_copy() + self.use_shift = True self.is_wan = True @torch.inference_mode() diff --git a/modules/infotext_utils.py b/modules/infotext_utils.py index 7b6139eb..213115fd 100644 --- a/modules/infotext_utils.py +++ b/modules/infotext_utils.py @@ -398,6 +398,9 @@ def parse_generation_parameters(x: str, skip_fields: list[str] | None = None): if "Refiner switch by sampling steps" not in res: res["Refiner switch by sampling steps"] = False + if "Shift" in res: + res["Distilled CFG Scale"] = res.pop("Shift") + infotext_versions.backcompat(res) for key in skip_fields: diff --git a/modules/processing.py b/modules/processing.py index 98445615..65b744ab 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -727,10 +727,10 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments=None, iter "CFG scale": p.cfg_scale, } - # if hires fix was used, p.firstpass_use_distilled_cfg_scale is appropriately set, otherwise it doesn't exist - firstpass_use_distilled_cfg_scale = getattr(p, "firstpass_use_distilled_cfg_scale", p.sd_model.use_distilled_cfg_scale) - if firstpass_use_distilled_cfg_scale: + if p.sd_model.use_distilled_cfg_scale: generation_params["Distilled CFG Scale"] = p.distilled_cfg_scale + if p.sd_model.use_shift: + generation_params["Shift"] = p.distilled_cfg_scale noise_source_type = get_noise_source_type() @@ -1418,7 +1418,6 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing): if self.hr_checkpoint_name and self.hr_checkpoint_name != "Use same checkpoint": checkpoint_changed = main_entry.checkpoint_change(self.hr_checkpoint_name, preset=None, save=False, refresh=False) if checkpoint_changed: - self.firstpass_use_distilled_cfg_scale = self.sd_model.use_distilled_cfg_scale reload = True if reload: