File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
pipelines/stable_diffusion Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,10 @@ def __call__(
9696
9797 self .scheduler .set_timesteps (num_inference_steps , ** extra_set_kwargs )
9898
99+ # if we use LMSDiscreteScheduler, let's make sure latents are mulitplied by sigmas
100+ if isinstance (self .scheduler , LMSDiscreteScheduler ):
101+ latents = latents * self .scheduler .sigmas [0 ]
102+
99103 # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
100104 # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
101105 # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
@@ -105,10 +109,6 @@ def __call__(
105109 if accepts_eta :
106110 extra_step_kwargs ["eta" ] = eta
107111
108- self .scheduler .set_timesteps (num_inference_steps )
109- if isinstance (self .scheduler , LMSDiscreteScheduler ):
110- latents = latents * self .scheduler .sigmas [0 ]
111-
112112 for i , t in tqdm (enumerate (self .scheduler .timesteps )):
113113 # expand the latents if we are doing classifier free guidance
114114 latent_model_input = torch .cat ([latents ] * 2 ) if do_classifier_free_guidance else latents
Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ def __init__(
3636 tensor_format = "pt" ,
3737 ):
3838 """
39- Linear Multistep Scheduler for discrete beta schedules.
40- Based on the original k-diffusion implementation by Katherine Crowson:
39+ Linear Multistep Scheduler for discrete beta schedules. Based on the original k-diffusion implementation by
40+ Katherine Crowson:
4141 https://github.com/crowsonkb/k-diffusion/blob/481677d114f6ea445aa009cf5bd7a9cdee909e47/k_diffusion/sampling.py#L181
4242 """
4343
You can’t perform that action at this time.
0 commit comments