mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-15 16:39:42 +00:00
feat: add guidance rescale options for Adaptive Projected Guidance in inference
This commit is contained in:
@@ -401,8 +401,6 @@ class AdaptiveProjectedGuidance:
|
||||
guidance_rescale: float = 0.0,
|
||||
use_original_formulation: bool = False,
|
||||
):
|
||||
assert guidance_rescale == 0.0, "guidance_rescale > 0.0 not supported."
|
||||
|
||||
self.guidance_scale = guidance_scale
|
||||
self.adaptive_projected_guidance_momentum = adaptive_projected_guidance_momentum
|
||||
self.adaptive_projected_guidance_rescale = adaptive_projected_guidance_rescale
|
||||
@@ -425,6 +423,10 @@ class AdaptiveProjectedGuidance:
|
||||
self.use_original_formulation,
|
||||
)
|
||||
|
||||
if self.guidance_rescale > 0.0:
|
||||
print(f"Applying guidance rescale with factor {self.guidance_rescale} at step {step}")
|
||||
pred = rescale_noise_cfg(pred, pred_cond, self.guidance_rescale)
|
||||
|
||||
return pred
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user