data
NCSNConfig
extends
GenerativeModelConfigNCSNConfig(sample_size: int | tuple[int, int] = 32, in_channels: int = 3, out_channels: int = 3, act_fn: GenerativeActivation = 'silu', 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.0, resnet_groups: int = 32, num_noise_levels: int = 10, sigma_max: float = 50.0, sigma_min: float = 0.01, langevin_steps: int = 100, langevin_eps: float = 2e-05)Configuration for every NCSN variant.
Parameters
base_channelsint= 128First U-Net stage width (paper: 128).
channel_multtuple[int, ...]= (lambda: (1, 2, 2, 2))()Per-stage channel multiplier. Same semantics as
DDPMConfig.num_res_blocksint= 2ResBlocks per stage.
attention_resolutionstuple[int, ...]= (lambda: (16,))()Spatial sizes at which to insert
self-attention.
num_headsint= 1Attention head count.
dropoutfloat= 0.0Dropout inside ResBlocks.
resnet_groupsint= 32GroupNorm group count.
num_noise_levelsint= 10Number of σ levels
L (paper L=10, NCSNv2 large
L ≈ 200–500).sigma_maxfloat= 50.0Largest noise σ_1 (paper CIFAR-10: 50.0).
sigma_minfloat= 0.01Smallest noise σ_L (paper CIFAR-10: 0.01).
langevin_stepsint= 100Sampler steps per σ level (paper T=100).
langevin_epsfloat= 2e-05Sampler step-size base (paper ε=2e-5). Per-σ step
size is
ε · σ_i² / σ_L² (Song 2019 §4.3).Used by 3
Constructors
1dunder
__init__
→None__init__(sample_size: int | tuple[int, int] = 32, in_channels: int = 3, out_channels: int = 3, act_fn: GenerativeActivation = 'silu', 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.0, resnet_groups: int = 32, num_noise_levels: int = 10, sigma_max: float = 50.0, sigma_min: float = 0.01, langevin_steps: int = 100, langevin_eps: float = 2e-05)