-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8729109
commit df2af6d
Showing
21 changed files
with
4,248 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
MPNet | ||
----------------------------------------------------------------------------------------------------------------------- | ||
|
||
Overview | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
The MPNet model was proposed in `MPNet: Masked and Permuted Pre-training for Language Understanding | ||
<https://arxiv.org/abs/2004.09297>`__ by Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, Tie-Yan Liu. | ||
|
||
MPNet adopts a novel pre-training method, named masked and permuted language modeling, to inherit the advantages of | ||
masked language modeling and permuted language modeling for natural language understanding. | ||
|
||
The abstract from the paper is the following: | ||
|
||
*BERT adopts masked language modeling (MLM) for pre-training and is one of the most successful pre-training models. | ||
Since BERT neglects dependency among predicted tokens, XLNet introduces permuted language modeling (PLM) for | ||
pre-training to address this problem. However, XLNet does not leverage the full position information of a sentence and | ||
thus suffers from position discrepancy between pre-training and fine-tuning. In this paper, we propose MPNet, a novel | ||
pre-training method that inherits the advantages of BERT and XLNet and avoids their limitations. MPNet leverages the | ||
dependency among predicted tokens through permuted language modeling (vs. MLM in BERT), and takes auxiliary position | ||
information as input to make the model see a full sentence and thus reducing the position discrepancy (vs. PLM in | ||
XLNet). We pre-train MPNet on a large-scale dataset (over 160GB text corpora) and fine-tune on a variety of | ||
down-streaming tasks (GLUE, SQuAD, etc). Experimental results show that MPNet outperforms MLM and PLM by a large | ||
margin, and achieves better results on these tasks compared with previous state-of-the-art pre-trained methods (e.g., | ||
BERT, XLNet, RoBERTa) under the same model setting.* | ||
|
||
Tips: | ||
|
||
- MPNet doesn't have :obj:`token_type_ids`, you don't need to indicate which token belongs to which segment. just | ||
separate your segments with the separation token :obj:`tokenizer.sep_token` (or :obj:`[sep]`). | ||
|
||
The original code can be found `here <https://github.com/microsoft/MPNet>`__. | ||
|
||
MPNetConfig | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetConfig | ||
:members: | ||
|
||
|
||
MPNetTokenizer | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetTokenizer | ||
:members: build_inputs_with_special_tokens, get_special_tokens_mask, | ||
create_token_type_ids_from_sequences, save_vocabulary | ||
|
||
|
||
MPNetTokenizerFast | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetTokenizerFast | ||
:members: | ||
|
||
|
||
MPNetModel | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetModel | ||
:members: forward | ||
|
||
|
||
MPNetForMaskedLM | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetForMaskedLM | ||
:members: forward | ||
|
||
|
||
MPNetForSequenceClassification | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetForSequenceClassification | ||
:members: forward | ||
|
||
|
||
MPNetForMultipleChoice | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetForMultipleChoice | ||
:members: forward | ||
|
||
|
||
MPNetForTokenClassification | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetForTokenClassification | ||
:members: forward | ||
|
||
|
||
MPNetForQuestionAnswering | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.MPNetForQuestionAnswering | ||
:members: forward | ||
|
||
|
||
TFMPNetModel | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.TFMPNetModel | ||
:members: call | ||
|
||
|
||
TFMPNetForMaskedLM | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.TFMPNetForMaskedLM | ||
:members: call | ||
|
||
|
||
TFMPNetForSequenceClassification | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.TFMPNetForSequenceClassification | ||
:members: call | ||
|
||
|
||
TFMPNetForMultipleChoice | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.TFMPNetForMultipleChoice | ||
:members: call | ||
|
||
|
||
TFMPNetForTokenClassification | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.TFMPNetForTokenClassification | ||
:members: call | ||
|
||
|
||
TFMPNetForQuestionAnswering | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. autoclass:: transformers.TFMPNetForQuestionAnswering | ||
:members: call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.