Diffusers documentation

ConsistencyDecoderScheduler

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.36.0).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

ConsistencyDecoderScheduler

This scheduler is a part of the ConsistencyDecoderPipeline and was introduced in DALL-E 3.

The original codebase can be found at openai/consistency_models.

ConsistencyDecoderScheduler

class diffusers.schedulers.ConsistencyDecoderScheduler

< >

( num_train_timesteps: int = 1024 sigma_data: float = 0.5 )

Parameters

  • num_train_timesteps (int, optional, defaults to 1024) — The number of diffusion steps to train the model.
  • sigma_data (float, optional, defaults to 0.5) — The standard deviation of the data distribution. Used for computing the skip and output scaling factors.

A scheduler for the consistency decoder used in Stable Diffusion pipelines.

This scheduler implements a two-step denoising process using consistency models for decoding latent representations into images.

This model inherits from SchedulerMixin and ConfigMixin. Check the superclass documentation for the generic methods the library implements for all schedulers such as loading and saving.

scale_model_input

< >

( sample: Tensor timestep: typing.Optional[int] = None ) torch.Tensor

Parameters

  • sample (torch.Tensor) — The input sample.
  • timestep (int, optional) — The current timestep in the diffusion chain.

Returns

torch.Tensor

A scaled input sample.

Ensures interchangeability with schedulers that need to scale the denoising model input depending on the current timestep.

set_timesteps

< >

( num_inference_steps: typing.Optional[int] = None device: typing.Union[str, torch.device, NoneType] = None )

Parameters

  • num_inference_steps (int, optional) — The number of diffusion steps used when generating samples with a pre-trained model. Currently, only 2 inference steps are supported.
  • device (str or torch.device, optional) — The device to which the timesteps should be moved to. If None, the timesteps are not moved.

Sets the discrete timesteps used for the diffusion chain (to be run before inference).

step

< >

( model_output: Tensor timestep: typing.Union[float, torch.Tensor] sample: Tensor generator: typing.Optional[torch._C.Generator] = None return_dict: bool = True ) ConsistencyDecoderSchedulerOutput or tuple

Parameters

  • model_output (torch.Tensor) — The direct output from the learned diffusion model.
  • timestep (float or torch.Tensor) — The current timestep in the diffusion chain.
  • sample (torch.Tensor) — A current instance of a sample created by the diffusion process.
  • generator (torch.Generator, optional) — A random number generator for reproducibility.
  • return_dict (bool, optional, defaults to True) — Whether or not to return a ConsistencyDecoderSchedulerOutput or tuple.

Returns

ConsistencyDecoderSchedulerOutput or tuple

If return_dict is True, ConsistencyDecoderSchedulerOutput is returned, otherwise a tuple is returned where the first element is the sample tensor.

Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion process from the learned model outputs (most often the predicted noise).

Update on GitHub