| 1717 | _keys_to_ignore_on_load_unexpected = [r"pooler"] |
| 1718 | |
| 1719 | def __init__(self, config): |
| 1720 | super().__init__(config) |
| 1721 | self.num_labels = config.num_labels |
| 1722 | |
| 1723 | self.bert = BertModel(config, add_pooling_layer=False) |
| 1724 | classifier_dropout = ( |
| 1725 | config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob |
| 1726 | ) |
| 1727 | self.dropout = nn.Dropout(classifier_dropout) |
| 1728 | self.classifier = nn.Linear(config.hidden_size, config.num_labels) |
| 1729 | |
| 1730 | # Initialize weights and apply final processing |
| 1731 | self.post_init() |
| 1732 | |
| 1733 | @add_start_docstrings_to_model_forward(BERT_INPUTS_DOCSTRING.format("batch_size, sequence_length")) |
| 1734 | @add_code_sample_docstrings( |