starling.inference.constraints.RgConstraint
- class RgConstraint[source]
Bases:
ConstraintMethods
Create constraint for radius of gyration (Rg).
applyApply the constraint to the given latents.
bell_shaped_scheduleBell-shaped schedule for time-dependent guidance strength.
Compute loss based on deviation from target Rg.
cosine_weightCosine schedule for time-dependent guidance strength.
get_adaptive_clip_thresholdGet an adaptive clipping threshold that follows a cosine schedule.
get_time_scaleGet the time-dependent scaling factor.
initializeCalled by the sampler to set model parameters.
should_apply_guidanceCheck if guidance should be applied at the current timestep.
- __init__(target, tolerance=0.0, force_constant=2.0, **kwargs)[source]
Create constraint for radius of gyration (Rg).
- compute_loss(distance_maps: Tensor) Tuple[Tensor, Tensor][source]
Compute loss based on deviation from target Rg.
- Parameters:
distance_maps (torch.Tensor) – Pre-computed distance maps from the latents
- Returns:
Per-batch loss and mean loss
- Return type:
Tuple[torch.Tensor, torch.Tensor]