Diffusers 文件

IPNDMScheduler

Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

IPNDMScheduler

IPNDMScheduler 是一個四階改進偽線性多步排程器。原始實現可在 crowsonkb/v-diffusion-pytorch 找到。

IPNDMScheduler

class diffusers.IPNDMScheduler

< >

( num_train_timesteps: int = 1000 trained_betas: typing.Union[numpy.ndarray, typing.List[float], NoneType] = None )

引數

  • num_train_timesteps (int, 預設為 1000) — 訓練模型的擴散步數。
  • trained_betas (np.ndarray, 可選) — 直接向建構函式傳入 betas 陣列,以繞過 beta_startbeta_end

一個四階改進偽線性多步排程器。

此模型繼承自 SchedulerMixinConfigMixin。請檢視超類文件,瞭解庫為所有排程器(如載入和儲存)實現的通用方法。

scale_model_input

< >

( sample: Tensor *args **kwargs ) torch.Tensor

引數

  • sample (torch.Tensor) — 輸入樣本。

返回

torch.Tensor

一個縮放後的輸入樣本。

確保與需要根據當前時間步縮放去噪模型輸入的排程器互換使用。

set_begin_index

< >

( begin_index: int = 0 )

引數

  • begin_index (int) — 排程器的起始索引。

設定排程器的起始索引。此函式應在推理之前從管道中執行。

set_timesteps

< >

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

引數

  • num_inference_steps (int) — 使用預訓練模型生成樣本時使用的擴散步數。
  • device (strtorch.device, 可選) — 時間步應移動到的裝置。如果為 None,時間步將不移動。

設定用於擴散鏈的離散時間步(在推理之前執行)。

步驟

< >

( model_output: Tensor timestep: typing.Union[int, torch.Tensor] sample: Tensor return_dict: bool = True ) SchedulerOutputtuple

引數

  • model_output (torch.Tensor) — 來自學習到的擴散模型的直接輸出。
  • timestep (int) — 擴散鏈中當前的離散時間步。
  • sample (torch.Tensor) — 擴散過程建立的樣本的當前例項。
  • return_dict (bool) — 是否返回 SchedulerOutput 或元組。

返回

排程器輸出tuple

如果 return_dict 為 True,則返回 SchedulerOutput,否則返回一個元組,其中第一個元素是樣本張量。

透過反轉 SDE 來預測前一個時間步的樣本。此函式使用線性多步方法傳播樣本。它執行多次前向傳播以近似解。

SchedulerOutput

class diffusers.schedulers.scheduling_utils.SchedulerOutput

< >

( prev_sample: Tensor )

引數

  • prev_sample (torch.Tensor,影像形狀為 (batch_size, num_channels, height, width)) — 上一個時間步計算出的樣本 (x_{t-1})prev_sample 應作為去噪迴圈中的下一個模型輸入。

排程器 step 函式輸出的基類。

< > 在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.