ScoringLossFunction

class lightning_ir.loss.base.ScoringLossFunction[source]

Bases: LossFunction

Base class for loss functions that operate on scores.

Methods

compute_loss(output, batch)

Compute the loss based on the scores and targets in the output and batch.

abstractmethod compute_loss(output: LightningIROutput, batch: TrainBatch) torch.Tensor[source]

Compute the loss based on the scores and targets in the output and batch.

Parameters:
  • output (LightningIROutput) – The output from the model containing scores.

  • batch (TrainBatch) – The training batch containing targets.

Returns:

The computed loss.

Return type:

torch.Tensor