Rename add_start_docstrings_to_callable (#8120)

This commit is contained in:
Sylvain Gugger
2020-10-28 13:42:31 -04:00
committed by GitHub
parent 6241c873cd
commit 378142afdf
55 changed files with 327 additions and 292 deletions

View File

@@ -28,7 +28,7 @@ from torch.nn import CrossEntropyLoss, MSELoss
from emmental import MaskedBertConfig
from emmental.modules import MaskedLinear
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_callable
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from transformers.modeling_bert import ACT2FN, BertLayerNorm, load_tf_weights_in_bert
from transformers.modeling_utils import PreTrainedModel, prune_linear_layer
@@ -498,7 +498,7 @@ class MaskedBertModel(MaskedBertPreTrainedModel):
for layer, heads in heads_to_prune.items():
self.encoder.layer[layer].attention.prune_heads(heads)
@add_start_docstrings_to_callable(MASKED_BERT_INPUTS_DOCSTRING)
@add_start_docstrings_to_model_forward(MASKED_BERT_INPUTS_DOCSTRING)
def forward(
self,
input_ids=None,
@@ -671,7 +671,7 @@ class MaskedBertForSequenceClassification(MaskedBertPreTrainedModel):
self.init_weights()
@add_start_docstrings_to_callable(MASKED_BERT_INPUTS_DOCSTRING)
@add_start_docstrings_to_model_forward(MASKED_BERT_INPUTS_DOCSTRING)
def forward(
self,
input_ids=None,
@@ -756,7 +756,7 @@ class MaskedBertForMultipleChoice(MaskedBertPreTrainedModel):
self.init_weights()
@add_start_docstrings_to_callable(MASKED_BERT_INPUTS_DOCSTRING)
@add_start_docstrings_to_model_forward(MASKED_BERT_INPUTS_DOCSTRING)
def forward(
self,
input_ids=None,
@@ -846,7 +846,7 @@ class MaskedBertForTokenClassification(MaskedBertPreTrainedModel):
self.init_weights()
@add_start_docstrings_to_callable(MASKED_BERT_INPUTS_DOCSTRING)
@add_start_docstrings_to_model_forward(MASKED_BERT_INPUTS_DOCSTRING)
def forward(
self,
input_ids=None,
@@ -932,7 +932,7 @@ class MaskedBertForQuestionAnswering(MaskedBertPreTrainedModel):
self.init_weights()
@add_start_docstrings_to_callable(MASKED_BERT_INPUTS_DOCSTRING)
@add_start_docstrings_to_model_forward(MASKED_BERT_INPUTS_DOCSTRING)
def forward(
self,
input_ids=None,