CoilEmbedding
- class lightning_ir.models.coil.CoilEmbedding(embeddings: Tensor, scoring_mask: Tensor | None = None, encoding: BatchEncoding | None = None, ids: List[str] | None = None, token_embeddings: Tensor | None = None, cls_embeddings: Tensor | None = None)[source]
Bases:
BiEncoderEmbeddingDataclass containing embeddings and the encoding for COIL models.
- __init__(embeddings: Tensor, scoring_mask: Tensor | None = None, encoding: BatchEncoding | None = None, ids: List[str] | None = None, token_embeddings: Tensor | None = None, cls_embeddings: Tensor | None = None) None
Methods
__init__(embeddings[, scoring_mask, ...])Attributes
Separate [CLS] token embeddings.
Token embeddings of the COIL model.
Raw embeddings of the COIL model.
- property device: device
Returns the device of the embeddings.
- Returns:
Device of the embeddings.
- Return type:
torch.device
- Raises:
ValueError – If the embeddings and scoring_mask are not on the same device.
- items() Iterable[Tuple[str, Tensor]]
Iterates over the embeddings attributes and their values like dict.items().
- Yields:
Tuple[str, torch.Tensor] – Tuple of attribute name and its value.
- scoring_mask: torch.Tensor | None = None
Mask tensor designating which vectors should be ignored during scoring.
- to(device) Self
Moves the embeddings to the specified device.
- Parameters:
device (torch.device | BiEncoderEmbedding) – Device to move the embeddings to or another instance to move to the same device.
- Returns:
The instance with embeddings moved to the specified device.
- Return type:
Self