starling.inference.constraints.MultiConstraint
- class MultiConstraint[source]
Bases:
ConstraintCombines multiple constraints into a single optimization step.
Methods
applyApply the constraint to the given latents.
bell_shaped_scheduleBell-shaped schedule for time-dependent guidance strength.
Compute weighted combination of all constraint losses.
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.
Initialize all constraints with the model parameters.
should_apply_guidanceCheck if guidance should be applied at the current timestep.
- __init__(constraints, schedule='cosine', verbose=True)[source]
- Parameters:
constraints (list) – List of constraint objects to combine
constraint_weights (list, optional) – Relative weights for each constraint (defaults to equal weights)
guidance_scale (float) – Overall guidance scale for the combined constraint
schedule (str) – Time schedule for constraint application (“cosine” or “linear”)
verbose (bool) – Whether to print debug info