Callbacks

SpladeRegularizerWeightSchedulerCallback

class sentence_transformers.sparse_encoder.callbacks.splade_callbacks.SpladeRegularizerWeightSchedulerCallback(loss: SpladeLoss, scheduler_type: str | SchedulerType = SchedulerType.QUADRATIC, warmup_ratio: float = 0.3333333333333333)[source]

Callback that updates the query_regularizer_weight and document_regularizer_weight parameters of SpladeLoss based on a schedule.

The scheduler gradually increases the weight values from 0 to their max value within the specified warmup ratio of the total training steps.

Parameters:
  • loss (SpladeLoss) – SpladeLoss instance to be updated

  • scheduler_type (str) – Type of scheduler (‘linear’ or ‘quadratic’)

  • warmup_ratio (float) – Ratio of total steps to reach max weight values (default: 1/3)