File tree Expand file tree Collapse file tree 2 files changed +4
-16
lines changed
src/diffusers/pipelines/stable_diffusion Expand file tree Collapse file tree 2 files changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -281,15 +281,9 @@ def __call__(
281
281
latents = init_latents
282
282
283
283
t_start = max (num_inference_steps - init_timestep + offset , 0 )
284
+ timesteps = self .scheduler .timesteps [t_start :]
284
285
285
- # Some schedulers like PNDM have timesteps as arrays
286
- # It's more optimzed to move all timesteps to correct device beforehand
287
- if torch .is_tensor (self .scheduler .timesteps ):
288
- timesteps_tensor = torch .tensor (self .scheduler .timesteps [t_start :], device = self .device )
289
- else :
290
- timesteps_tensor = torch .tensor (self .scheduler .timesteps .copy ()[t_start :], device = self .device )
291
-
292
- for i , t in enumerate (self .progress_bar (timesteps_tensor )):
286
+ for i , t in enumerate (self .progress_bar (timesteps )):
293
287
t_index = t_start + i
294
288
295
289
# expand the latents if we are doing classifier free guidance
Original file line number Diff line number Diff line change @@ -315,15 +315,9 @@ def __call__(
315
315
latents = init_latents
316
316
317
317
t_start = max (num_inference_steps - init_timestep + offset , 0 )
318
+ timesteps = self .scheduler .timesteps .copy ()[t_start :]
318
319
319
- # Some schedulers like PNDM have timesteps as arrays
320
- # It's more optimzed to move all timesteps to correct device beforehand
321
- if torch .is_tensor (self .scheduler .timesteps ):
322
- timesteps_tensor = torch .tensor (self .scheduler .timesteps [t_start :], device = self .device )
323
- else :
324
- timesteps_tensor = torch .tensor (self .scheduler .timesteps .copy ()[t_start :], device = self .device )
325
-
326
- for i , t in tqdm (enumerate (timesteps_tensor )):
320
+ for i , t in tqdm (enumerate (timesteps )):
327
321
t_index = t_start + i
328
322
# expand the latents if we are doing classifier free guidance
329
323
latent_model_input = torch .cat ([latents ] * 2 ) if do_classifier_free_guidance else latents
You can’t perform that action at this time.
0 commit comments