MCPcopy Create free account
hub / github.com/AnswerDotAI/ModernBERT / __init__

Method __init__

src/bert_layers/model.py:589–607  ·  view source on GitHub ↗
(self, config)

Source from the content-addressed store, hash-verified

587 """
588
589 def __init__(self, config):
590 super().__init__(config)
591 self.num_labels = config.num_labels
592 self.config = config
593
594 self.bert = BertModel(config)
595 classifier_dropout = (
596 config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob
597 )
598 self.dropout = nn.Dropout(classifier_dropout)
599
600 # In multiple choice tasks, all choices are submitted in a batch, and
601 # we compute a logit for each option independently. The logits are then
602 # normalized in the forward pass to get a probability distribution over
603 # the choices.
604 self.classifier = nn.Linear(config.hidden_size, 1)
605
606 # Initialize weights and apply final processing
607 self.post_init()
608
609 @classmethod
610 def from_composer(

Callers

nothing calls this directly

Calls 3

BertModelClass · 0.85
post_initMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected