File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
xfuser/model_executor/pipelines Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
import torch
5
5
import torch .distributed
6
+ import inspect
6
7
from diffusers import CogVideoXPipeline
7
8
from diffusers .pipelines .cogvideo .pipeline_cogvideox import (
8
9
CogVideoXPipelineOutput ,
@@ -404,6 +405,24 @@ def _init_sync_pipeline(
404
405
)
405
406
return latents , prompt_embeds , image_rotary_emb
406
407
408
+
409
+ def prepare_extra_step_kwargs (self , generator , eta ):
410
+ # prepare extra kwargs for the scheduler step, since not all schedulers have the same signature
411
+ # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers.
412
+ # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502
413
+ # and should be between [0, 1]
414
+
415
+ accepts_eta = "eta" in set (inspect .signature (self .scheduler .module .step ).parameters .keys ())
416
+ extra_step_kwargs = {}
417
+ if accepts_eta :
418
+ extra_step_kwargs ["eta" ] = eta
419
+
420
+ # check if the scheduler accepts generator
421
+ accepts_generator = "generator" in set (inspect .signature (self .scheduler .module .step ).parameters .keys ())
422
+ if accepts_generator :
423
+ extra_step_kwargs ["generator" ] = generator
424
+ return extra_step_kwargs
425
+
407
426
@property
408
427
def interrupt (self ):
409
428
return self ._interrupt
You can’t perform that action at this time.
0 commit comments