MolecularDiffusion.modules.models.ligandiff.noise

Diffusion noise schedules. Verbatim port of LigandDiff’s src/noise.py.

Both branches matter: polynomial_2 is upstream’s config.yml default for fresh training, while the released model/pretrained.ckpt was trained with the learned GammaNetwork (its edm.gamma.{gamma_0,gamma_1,l1,l2,l3} tensors are in the checkpoint). Selecting the wrong one makes those eight tensors arrive as unexpected keys, which cli/generate.py’s strict=False load silently drops.

Classes

GammaNetwork

Monotonic learned gamma schedule (VDM paper construction).

PositiveLinear

Linear layer with weights forced to be positive.

PredefinedNoiseSchedule

Lookup table for a fixed (non-learned) noise schedule.

Functions

clip_noise_schedule(alphas2[, clip_value])

Clip alpha_t / alpha_{t-1} for sampling stability.

cosine_beta_schedule(timesteps[, s, raise_to_power])

Cosine schedule (Nichol & Dhariwal).

polynomial_schedule(timesteps[, s, power])

Noise schedule based on 1 - x^power.

Module Contents

class MolecularDiffusion.modules.models.ligandiff.noise.GammaNetwork

Bases: torch.nn.Module

Monotonic learned gamma schedule (VDM paper construction).

forward(t)
gamma_tilde(t)
gamma_0
gamma_1
l1
l2
l3
class MolecularDiffusion.modules.models.ligandiff.noise.PositiveLinear(in_features: int, out_features: int, bias: bool = True, weight_init_offset: int = -2)

Bases: torch.nn.Module

Linear layer with weights forced to be positive.

forward(x)
reset_parameters() None
in_features
out_features
weight
weight_init_offset = -2
class MolecularDiffusion.modules.models.ligandiff.noise.PredefinedNoiseSchedule(noise_schedule, timesteps, precision)

Bases: torch.nn.Module

Lookup table for a fixed (non-learned) noise schedule.

forward(t)
gamma
timesteps
MolecularDiffusion.modules.models.ligandiff.noise.clip_noise_schedule(alphas2, clip_value=0.001)

Clip alpha_t / alpha_{t-1} for sampling stability.

MolecularDiffusion.modules.models.ligandiff.noise.cosine_beta_schedule(timesteps, s=0.008, raise_to_power: float = 1)

Cosine schedule (Nichol & Dhariwal).

MolecularDiffusion.modules.models.ligandiff.noise.polynomial_schedule(timesteps: int, s=0.0001, power=3.0)

Noise schedule based on 1 - x^power.