InfoNCE
- class lightning_ir.loss.listwise.InfoNCE[source]
Bases:
ListwiseLossFunctionInfoNCE loss for listwise ranking tasks. Originally proposed in: Representation Learning with Contrastive Predictive Coding
Methods
compute_loss(output, batch)Compute the InfoNCE loss.
- compute_loss(output: LightningIROutput, batch: TrainBatch) torch.Tensor[source]
Compute the InfoNCE loss.
- 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