This commit is contained in:
Haoming 2025-10-31 11:31:37 +08:00
parent 21e78ee7ea
commit f7cb7cdb0d
5 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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:

View File

@ -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: