(self, config)
| 1004 | @add_start_docstrings("""Bert Model with a `language modeling` head on top. """, BERT_START_DOCSTRING) |
| 1005 | class BertForMaskedLM(BertPreTrainedModel): |
| 1006 | def __init__(self, config): |
| 1007 | super().__init__(config) |
| 1008 | assert ( |
| 1009 | not config.is_decoder |
| 1010 | ), "If you want to use `BertForMaskedLM` make sure `config.is_decoder=False` for bi-directional self-attention." |
| 1011 | |
| 1012 | self.bert = BertModel(config) |
| 1013 | self.cls = BertOnlyMLMHead(config) |
| 1014 | |
| 1015 | self.init_weights() |
| 1016 | |
| 1017 | def get_output_embeddings(self): |
| 1018 | return self.cls.predictions.decoder |
nothing calls this directly
no test coverage detected