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.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

ConsistencyDecoderScheduler

此调度器是 ConsistencyDecoderPipeline 的一部分,并在 DALL-E 3 中引入。

原始代码库可在 openai/consistency_models 中找到。

ConsistencyDecoderScheduler

class diffusers.schedulers.ConsistencyDecoderScheduler

< >

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

参数

  • num_train_timesteps (int,可选,默认为 1024) — 用于训练模型的扩散步数。
  • sigma_data (float,可选,默认为 0.5) — 数据分布的标准差。用于计算跳跃和输出缩放因子。

用于 Stable Diffusion 流水线中一致性解码器的调度器。

该调度器使用一致性模型实现两步去噪过程,将潜在表示解码为图像。

该模型继承自 SchedulerMixin 和 ConfigMixin。有关该库为所有调度器实现的通用方法(例如加载和保存),请参阅父类文档。

scale_model_input

< >

( sample: Tensortimestep: int | None = None ) → torch.Tensor

参数

  • sample (torch.Tensor) — 输入样本。
  • timestep (int, 可选) — 扩散链中的当前时间步。

返回值

torch.Tensor

经过缩放的输入样本。

确保与那些需要根据当前时间步对去噪模型输入进行缩放的调度器之间的可互换性。

步骤

< >

( model_output: Tensortimestep: typing.Union[float, torch.Tensor]sample: Tensorgenerator: typing.Optional[torch.Generator] = Nonereturn_dict: bool = True ) → ConsistencyDecoderSchedulerOutput or tuple

参数

  • model_output (torch.Tensor) — 学习到的扩散模型的直接输出。
  • timestep (float 或 torch.Tensor) — 扩散链中的当前时间步。
  • sample (torch.Tensor) — 扩散过程生成的样本的当前实例。
  • generator (torch.Generator, 可选) — 用于确保可复现性的随机数生成器。
  • return_dict (bool,可选,默认为 True) — 是否返回 ConsistencyDecoderSchedulerOutput 或 tuple。

返回值

ConsistencyDecoderSchedulerOutput 或 tuple

如果 return_dict 为 True,则返回 ConsistencyDecoderSchedulerOutput,否则返回一个元组,其中第一个元素是样本张量。

通过逆向 SDE 预测上一时间步的样本。此函数将扩散过程从学习到的模型输出(通常是预测的噪声)进行传播。

Update on GitHub