LitDDPM#
- class dmme.lit_modules.LitDDPM(lr: float = 0.0002, warmup: int = 5000, decay: float = 0.9999, diffusion_model: Optional[DDPM] = None, model: Optional[Module] = None, timesteps: int = 1000)[source]#
LightningModule for training DDPM
- Parameters:
lr – learning rate, defaults to
2e-4warmup – linearly increases learning rate for warmup steps until lr is reached, defaults to 5000
decay – EMA decay value
diffusion_model – overrides default diffusion_model
DDPMmodel – overrides default model passed to
DDPMtimesteps – default timesteps passed to
DDPM
- forward(x_t: Tensor, t: int)[source]#
Denoise image once using DDPM
- Parameters:
x_t – image of shape \((N, C, H, W)\)
t (int) – starting \(t\) to sample from
noise – noise to use for sampling, if None samples new noise
- Returns:
generated sample of shape \((N, C, H, W)\)