NCSNConfig
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, backbone: Literal['ddpm_unet', 'refinenet'] = 'ddpm_unet', num_noise_levels: int = 10, sigma_max: float = 1.0, sigma_min: float = 0.01, langevin_steps: int = 100, langevin_eps: float = 2e-05, scale_by_sigma: bool = True, denoise: bool = True)Configuration for every NCSN variant.
Args:
base_channels: First U-Net stage width (paper: 128).
channel_mult: Per-stage channel multiplier. Same semantics as
DDPMConfig.
num_res_blocks: ResBlocks per stage.
attention_resolutions: Spatial sizes at which to insert
self-attention.
num_heads: Attention head count.
dropout: Dropout inside ResBlocks.
resnet_groups: GroupNorm group count.
num_noise_levels: Number of σ levels L (paper L=10, NCSNv2 large
L ≈ 200–500).
sigma_max: Largest noise σ_1. 50.0 belongs to NCSNv2 (Technique 1)
and goes with L = 232; NCSN v1 uses σ_1 = 1.0 with L = 10.
Mixing the two breaks Technique 2's ratio criterion.
sigma_min: Smallest noise σ_L (paper CIFAR-10: 0.01).
langevin_steps: Sampler steps per σ level (paper T=100).
langevin_eps: Sampler step-size base (paper ε=2e-5). Per-σ step
size is ε · σ_i² / σ_L² (Song 2019 §4.3).
scale_by_sigma: Divide the network output by σ (NCSNv2 Technique 3).
Default True; set False for the NCSN v1 parameterisation.
Examples
>>> from lucid.models.generative.ncsn._config import NCSNConfig
>>> cfg = NCSNConfig()
>>> cfg.model_type
'ncsn'
>>> cfg.in_channels
3Used by 3
Constructors
1__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, backbone: Literal['ddpm_unet', 'refinenet'] = 'ddpm_unet', num_noise_levels: int = 10, sigma_max: float = 1.0, sigma_min: float = 0.01, langevin_steps: int = 100, langevin_eps: float = 2e-05, scale_by_sigma: bool = True, denoise: bool = True)