EmbeddingLossFunction

class lightning_ir.loss.base.EmbeddingLossFunction[source]

Bases: LossFunction

Base class for loss functions that operate on embeddings.

Methods

compute_loss(output)

Compute the loss based on the embeddings in the output.

abstractmethod compute_loss(output: BiEncoderOutput) torch.Tensor[source]

Compute the loss based on the embeddings in the output.

Parameters:

output (BiEncoderOutput) – The output from the model containing query and document embeddings.

Returns:

The computed loss.

Return type:

torch.Tensor