data
DDPMConfig
extends
DiffusionModelConfigDDPMConfig(sample_size: int | tuple[int, int] = 32, in_channels: int = 3, out_channels: int = 3, act_fn: GenerativeActivation = 'silu', num_train_timesteps: int = 1000, beta_start: float = 0.0001, beta_end: float = 0.02, beta_schedule: BetaSchedule = 'linear', prediction_type: Literal['epsilon', 'sample', 'v_prediction'] = 'epsilon', base_channels: int = 128, channel_mult: tuple[int, ...] = (lambda: (1, 2, 2, 2))(), num_res_blocks: int = 2, attention_resolutions: tuple[int, ...] = (lambda: (16,))(), num_heads: int = 1, dropout: float = 0.1, resnet_groups: int = 32, learn_sigma: bool = False, clip_denoised: bool = True)Configuration for every DDPM variant.
Parameters
base_channelsint= 128Channel width of the first U-Net stage
C_0. All
other stages are integer multiples (see channel_mult).
Paper default: 128.channel_multtuple[int, ...]= (lambda: (1, 2, 2, 2))()Per-stage channel multiplier.
(1, 2, 2, 2) for
CIFAR (Table 9), (1, 1, 2, 2, 4, 4) for LSUN/CelebA-HQ.
Length = number of downsampling stages; spatial resolution
divides by 2 ** (L - 1) (no downsample after the final
stage).num_res_blocksint= 2ResBlocks per stage (paper: 2).
attention_resolutionstuple[int, ...]= (lambda: (16,))()Spatial sizes at which self-attention is
applied. Ho 2020 uses
(16,) — attention only at the
16×16 feature scale.num_headsint= 1Attention head count (paper: 1 for CIFAR, can scale).
dropoutfloat= 0.1Dropout inside ResBlocks. Paper: 0.1 (CIFAR), 0.0
(CelebA / LSUN).
resnet_groupsint= 32GroupNorm group count inside ResBlocks (paper
default: 32). Must divide every per-stage channel count.learn_sigmabool= FalseImproved-DDPM (Nichol 2021) — when
True, the
network predicts the variance in addition to the mean. Output
channels become 2 * in_channels.clip_denoisedbool= TrueClip the predicted
x_0 to [-1, 1] during
sampling (default True).Used by 4
Constructors
1dunder
__init__
→None__init__(sample_size: int | tuple[int, int] = 32, in_channels: int = 3, out_channels: int = 3, act_fn: GenerativeActivation = 'silu', num_train_timesteps: int = 1000, beta_start: float = 0.0001, beta_end: float = 0.02, beta_schedule: BetaSchedule = 'linear', prediction_type: Literal['epsilon', 'sample', 'v_prediction'] = 'epsilon', base_channels: int = 128, channel_mult: tuple[int, ...] = (lambda: (1, 2, 2, 2))(), num_res_blocks: int = 2, attention_resolutions: tuple[int, ...] = (lambda: (16,))(), num_heads: int = 1, dropout: float = 0.1, resnet_groups: int = 32, learn_sigma: bool = False, clip_denoised: bool = True)