span_marker.output module¶
- class span_marker.output.SpanMarkerOutput(loss=None, logits=None, hidden_states=None, attentions=None, num_marker_pairs=None, num_words=None, document_ids=None, sentence_ids=None)[source]¶
Bases:
TokenClassifierOutputClass for outputs of
SpanMarkerModel.- Parameters:
loss (Optional[torch.FloatTensor]) – Classification loss of shape
(1,), returned whenlabelsis provided.logits (torch.FloatTensor) – Classification scores before softmax with shape
(batch_size, sequence_length, config.num_labels).hidden_states (Optional[Tuple[torch.FloatTensor]]) –
Tuple of
FloatTensor(one for the output of the embeddings, if the model has an embedding layer, + one for the output of each layer) of shape(batch_size, sequence_length, hidden_size). Returned whenconfig.output_hidden_states=True.Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
attentions (Optional[Tuple[torch.FloatTensor]]) –
Tuple of
FloatTensor(one for each layer) of shape(batch_size, num_heads, sequence_length, sequence_length). Returned whenconfig.output_attentions=True.Attentions weights after the attention softmax, used to compute the weighted average in the self-attention heads.
num_words (Optional[Tensor]) – A vector with shape
(batch_size,)that tracks how many words were in the input of each sample in the batch. Required for evaluation purposes.document_ids (Optional[Tensor]) – A vector with shape
(batch_size,)that tracks the document the input text belongs to.sentence_ids (Optional[Tensor]) – A vector with shape
(batch_size,)that tracks the sentence in the document that the input text belongs to.num_marker_pairs (Tensor | None) –