MCPcopy Create free account
hub / github.com/Hzfinfdu/Diffusion-BERT / BertForPreTrainingOutput

Class BertForPreTrainingOutput

models/modeling_bert.py:769–799  ·  view source on GitHub ↗

Output type of [`BertForPreTraining`]. Args: loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`): Total loss as the sum of the masked language modeling loss and the next sequence prediction (classification) loss.

Source from the content-addressed store, hash-verified

767
768@dataclass
769class BertForPreTrainingOutput(ModelOutput):
770 """
771 Output type of [`BertForPreTraining`].
772
773 Args:
774 loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
775 Total loss as the sum of the masked language modeling loss and the next sequence prediction
776 (classification) loss.
777 prediction_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
778 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
779 seq_relationship_logits (`torch.FloatTensor` of shape `(batch_size, 2)`):
780 Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
781 before SoftMax).
782 hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
783 Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
784 shape `(batch_size, sequence_length, hidden_size)`.
785
786 Hidden-states of the model at the output of each layer plus the initial embedding outputs.
787 attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
788 Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
789 sequence_length)`.
790
791 Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
792 heads.
793 """
794
795 loss: Optional[torch.FloatTensor] = None
796 prediction_logits: torch.FloatTensor = None
797 seq_relationship_logits: torch.FloatTensor = None
798 hidden_states: Optional[Tuple[torch.FloatTensor]] = None
799 attentions: Optional[Tuple[torch.FloatTensor]] = None
800
801
802BERT_START_DOCSTRING = r"""

Callers 1

forwardMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected