agedi.diffusion.samplers.pc¶
Predictor-corrector sampler — EM predictor with Langevin correctors.
Classes¶
Euler-Maruyama predictor with Langevin corrector steps. |
Module Contents¶
- class agedi.diffusion.samplers.pc.PredictorCorrectorSampler(score_fn: Callable[[agedi.data.AtomsGraph], agedi.data.AtomsGraph], noisers: List[agedi.diffusion.noisers.Noiser], corrector_steps: int = 1, corrector_step_size: float = 0.001)¶
Bases:
agedi.diffusion.samplers.base.SamplerEuler-Maruyama predictor with Langevin corrector steps.
After the standard EM predictor step advances the state from
ttot - dt, this sampler appliescorrector_stepsLangevin corrector steps at the new noise levelt - dt. This is the conventional predictor-corrector scheme from Song et al. (2021).- Parameters:
score_fn (callable) – Score-model forward function.
noisers (list of Noiser) – Noisers in forward order.
corrector_steps (int, optional) – Number of Langevin corrector passes per predictor step. Default: 1.
corrector_step_size (float, optional) – Step size for each Langevin corrector step. Default: 1e-3.
Notes
The corrector runs at the new time
t_{i-1} = t_i - dt(after the predictor), which is the standard convention. The legacycorrector_stepsinteger parameter onsample()uses the same convention via this class.- corrector_steps = 1¶
- corrector_step_size = 0.001¶
- _corrector_dt: torch.Tensor | None = None¶
- step(batch: agedi.data.AtomsGraph, dt: torch.Tensor, last: bool) agedi.data.AtomsGraph¶
Predictor-corrector step.
EM predictor: evaluate score, apply
noiser.denoise(), wrap & rebuild.Advance
batch.timetot - dt.For each corrector iteration: evaluate score, apply Langevin step via
noiser.langevin_step(), wrap & rebuild.