Diffusers documentation
IPNDMScheduler
IPNDMScheduler
IPNDMScheduler 是一种四阶改进伪线性多步调度器。其原始实现可在 crowsonkb/v-diffusion-pytorch 中找到。
IPNDMScheduler
class diffusers.IPNDMScheduler
< source >( num_train_timesteps: int = 1000trained_betas: numpy.ndarray | list[float] | None = None )
四阶改进伪线性多步调度器。
该模型继承自 SchedulerMixin 和 ConfigMixin。有关该库为所有调度器实现的通用方法(例如加载和保存),请参阅父类文档。
index_for_timestep
< source >( timestep: typing.Union[float, torch.Tensor]schedule_timesteps: typing.Optional[torch.Tensor] = None ) → int
查找给定时间步在时间步调度中的索引。
scale_model_input
< source >( sample: Tensor*args**kwargs ) → torch.Tensor
确保与那些需要根据当前时间步对去噪模型输入进行缩放的调度器之间的可互换性。
设置调度器的起始索引。此函数应在推理之前从流水线中运行。
set_timesteps
< source >( num_inference_steps: intdevice: typing.Union[str, torch.device, NoneType] = None )
设置扩散链所使用的离散时间步(需在推理之前运行)。
步骤
< source >( model_output: Tensortimestep: typing.Union[int, torch.Tensor]sample: Tensorreturn_dict: bool = True ) → SchedulerOutput or tuple
参数
- model_output (
torch.Tensor) — 学习到的扩散模型的直接输出。 - timestep (
int或torch.Tensor) — 扩散链中的当前离散时间步。 - sample (
torch.Tensor) — 扩散过程生成的样本的当前实例。 - return_dict (
bool) — 是否返回 SchedulerOutput 或元组。
返回值
SchedulerOutput 或 tuple
If return_dict is True, SchedulerOutput is returned, otherwise a
tuple is returned where the first element is the sample tensor.
通过逆向 SDE 预测上一步时间步的样本。此函数使用线性多步法传播样本。它多次执行前向传播以近似求解。
SchedulerOutput
class diffusers.schedulers.scheduling_utils.SchedulerOutput
< source >( prev_sample: Tensor )
调度器 step 函数输出的基类。