utils
¶
Utility functions for pipeline stages.
Functions¶
fastvideo.pipelines.stages.utils.retrieve_timesteps
¶
retrieve_timesteps(scheduler: Any, num_inference_steps: int | None = None, device: str | device | None = None, timesteps: list[int] | None = None, sigmas: list[float] | None = None, **kwargs: Any) -> tuple[Any, int]
Calls the scheduler's set_timesteps method and retrieves timesteps from the scheduler after the call. Handles
custom timesteps. Any kwargs will be supplied to scheduler.set_timesteps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scheduler
|
`SchedulerMixin`
|
The scheduler to get timesteps from. |
required |
num_inference_steps
|
`int`
|
The number of diffusion steps used when generating samples with a pre-trained model. If used, |
None
|
device
|
`str` or `torch.device`, *optional*
|
The device to which the timesteps should be moved to. If |
None
|
timesteps
|
`List[int]`, *optional*
|
Custom timesteps used to override the timestep spacing strategy of the scheduler. If |
None
|
sigmas
|
`List[float]`, *optional*
|
Custom sigmas used to override the timestep spacing strategy of the scheduler. If |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
|
int
|
second element is the number of inference steps. |