Skip to content

Commit 9195ef7

Browse files
committed
Add dynamic_shifting to SD3
1 parent 5fb3a98 commit 9195ef7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ def __call__(
702702
skip_layer_guidance_scale: int = 2.8,
703703
skip_layer_guidance_stop: int = 0.2,
704704
skip_layer_guidance_start: int = 0.01,
705+
mu: Optional[float] = None,
705706
):
706707
r"""
707708
Function invoked when calling the pipeline for generation.
@@ -802,6 +803,7 @@ def __call__(
802803
`skip_guidance_layers` will start. The guidance will be applied to the layers specified in
803804
`skip_guidance_layers` from the fraction specified in `skip_layer_guidance_start`. Recommended value by
804805
StabiltyAI for Stable Diffusion 3.5 Medium is 0.01.
806+
mu (`float`, *optional*): `mu` value used for `dynamic_shifting`.
805807
806808
Examples:
807809
@@ -883,7 +885,13 @@ def __call__(
883885
pooled_prompt_embeds = torch.cat([negative_pooled_prompt_embeds, pooled_prompt_embeds], dim=0)
884886

885887
# 4. Prepare timesteps
886-
timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, sigmas=sigmas)
888+
timesteps, num_inference_steps = retrieve_timesteps(
889+
self.scheduler,
890+
num_inference_steps,
891+
device,
892+
sigmas=sigmas,
893+
mu=mu,
894+
)
887895
num_warmup_steps = max(len(timesteps) - num_inference_steps * self.scheduler.order, 0)
888896
self._num_timesteps = len(timesteps)
889897

0 commit comments

Comments
 (0)