Skip to content

Commit

Permalink
Support more model outputs for BERT/ERNIE/RoBERTa (#2665)
Browse files Browse the repository at this point in the history
* Support more model outputs for BERT.

* Make more task classed support more outputs.

* Convert list to tuple automatically in ModelOutput.

* Support more model outputs for ERNIE.

* Support more model outputs for Roberta.

* Add embedding output to all hidden states.

* Clean import in model_output.py

* Make output of BERT/ERNIE/RoBerta be tensor instead of tuple when the size of tuple is one.

* Make monkey patches for forward of PretrainedModel compatible with the latest forward.

* Add compatibility for patches of paddle.nn.Transformer

* Fix dygraph to static graph with more outputs.

* Fix setattr for subclass of TransformerEncoder such as Electra.
  • Loading branch information
guoshengCS authored Jul 11, 2022
1 parent cf055c8 commit 548d59a
Show file tree
Hide file tree
Showing 7 changed files with 1,197 additions and 185 deletions.
2 changes: 1 addition & 1 deletion paddlenlp/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@
if is_faster_tokenizer_available():
from .bert.faster_tokenizer import *
from .ernie.faster_tokenizer import *
from .tinybert.faster_tokenizer import *
from .tinybert.faster_tokenizer import *
Loading

0 comments on commit 548d59a

Please sign in to comment.