Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFMarian, TFMbart, TFPegasus, TFBlenderbot #7987

Merged
merged 47 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2c9d94e
Start plumbing
sshleifer Oct 21, 2020
c2b3194
Marian close
sshleifer Oct 21, 2020
376bf6d
Small stubs for all children
sshleifer Oct 21, 2020
418599c
Fixed bart
sshleifer Oct 21, 2020
6cba94f
marian working
sshleifer Oct 21, 2020
06efa16
pegasus test is good, but failing
sshleifer Oct 21, 2020
f8b9cb4
Checkin tests
sshleifer Oct 21, 2020
8e692ca
More model files
sshleifer Oct 21, 2020
67fa622
Subtle marian, pegasus integration test failures
sshleifer Oct 22, 2020
24912bc
Merge branch 'master' into tf-children
sshleifer Oct 22, 2020
79eaae6
Merge branch 'master' into tf-children
sshleifer Oct 22, 2020
f903077
Works well
sshleifer Oct 22, 2020
34e2297
rm print
sshleifer Oct 22, 2020
2e6377e
boom boom
sshleifer Oct 22, 2020
9669174
Still failing model2doc
sshleifer Oct 22, 2020
a10c8fb
Merge branch 'master' into tf-children
sshleifer Oct 22, 2020
92fc836
merge master
sshleifer Oct 22, 2020
6ad935b
Equivalence test failing, all others fixed
sshleifer Oct 22, 2020
4c93ab4
Merge branch 'master' into tf-children
sshleifer Oct 25, 2020
5976bc7
cleanup
sshleifer Oct 25, 2020
7dde6d9
Fix embed_scale
sshleifer Oct 25, 2020
87b1ad6
Cleanup marian pipeline test
sshleifer Oct 25, 2020
91f642b
Undo extra changes
sshleifer Oct 25, 2020
e0f06e8
Smaller delta
sshleifer Oct 25, 2020
33cba02
Cleanup model testers
sshleifer Oct 25, 2020
aade43e
undo delta
sshleifer Oct 25, 2020
e895506
fix tests import structure
sshleifer Oct 25, 2020
dd2ecc2
cross test decorator
sshleifer Oct 25, 2020
1b1ce21
Merge branch 'master' into tf-children
sshleifer Oct 26, 2020
fa8c5eb
Cleaner set_weights
sshleifer Oct 26, 2020
b07d20b
Respect authorized_unexpected_keys
sshleifer Oct 26, 2020
7c3e1f7
No warnings
sshleifer Oct 26, 2020
d097e27
No warnings
sshleifer Oct 26, 2020
cbee996
style
sshleifer Oct 26, 2020
5340a67
Nest tf import
sshleifer Oct 26, 2020
be9de10
black
sshleifer Oct 26, 2020
1d86346
Apply suggestions from code review
sshleifer Oct 26, 2020
66f1d06
functional dropout
sshleifer Oct 26, 2020
e09d774
Merge branch 'tf-children' of github.com:sshleifer/transformers_fork …
sshleifer Oct 26, 2020
20fd262
Merge branch 'master' into tf-children
sshleifer Oct 26, 2020
1b82b63
fixup
sshleifer Oct 27, 2020
9ebbe55
Fixup
sshleifer Oct 27, 2020
b03c953
style_doc
sshleifer Oct 27, 2020
13583d7
embs
sshleifer Oct 28, 2020
eb613d8
shape list
sshleifer Oct 28, 2020
0618986
delete slow force_token_id_to_be_generated func
sshleifer Oct 28, 2020
60d2ab4
fixup
sshleifer Oct 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/source/model_doc/blenderbot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,12 @@ See :obj:`transformers.BartForConditionalGeneration` for arguments to `forward`

.. autoclass:: transformers.BlenderbotForConditionalGeneration
:members:


TFBlenderbotForConditionalGeneration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See :obj:`transformers.TFBartForConditionalGeneration` for arguments to `forward` and `generate`

.. autoclass:: transformers.TFBlenderbotForConditionalGeneration
:members:
6 changes: 6 additions & 0 deletions docs/source/model_doc/marian.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,9 @@ MarianMTModel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.MarianMTModel


TFMarianMTModel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFMarianMTModel
9 changes: 8 additions & 1 deletion docs/source/model_doc/mbart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,11 @@ MBartForConditionalGeneration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.MBartForConditionalGeneration
:members: forward
:members:


TFMBartForConditionalGeneration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFMBartForConditionalGeneration
:members:
6 changes: 6 additions & 0 deletions docs/source/model_doc/pegasus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,9 @@ PegasusForConditionalGeneration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.PegasusForConditionalGeneration


TFPegasusForConditionalGeneration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: transformers.TFPegasusForConditionalGeneration
4 changes: 4 additions & 0 deletions src/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@
TFBertModel,
TFBertPreTrainedModel,
)
from .modeling_tf_blenderbot import TFBlenderbotForConditionalGeneration
from .modeling_tf_camembert import (
TF_CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
TFCamembertForMaskedLM,
Expand Down Expand Up @@ -750,6 +751,8 @@
TFLxmertPreTrainedModel,
TFLxmertVisualFeatureEncoder,
)
from .modeling_tf_marian import TFMarianMTModel
from .modeling_tf_mbart import TFMBartForConditionalGeneration
from .modeling_tf_mobilebert import (
TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
TFMobileBertForMaskedLM,
Expand All @@ -771,6 +774,7 @@
TFOpenAIGPTModel,
TFOpenAIGPTPreTrainedModel,
)
from .modeling_tf_pegasus import TFPegasusForConditionalGeneration
from .modeling_tf_roberta import (
TF_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
TFRobertaForMaskedLM,
Expand Down
4 changes: 1 addition & 3 deletions src/transformers/modeling_bart.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ def forward(
output_attentions=False,
):
residual = x

if layer_state is None:
layer_state = {}
if self.normalize_before:
Expand All @@ -447,7 +446,7 @@ def forward(
if not self.normalize_before:
x = self.self_attn_layer_norm(x)

# Cross attention
# Cross-Attention Block
residual = x
assert self.encoder_attn.cache_key != self.self_attn.cache_key
if self.normalize_before:
Expand Down Expand Up @@ -628,7 +627,6 @@ def forward(
encoder_hidden_states = encoder_hidden_states.transpose(0, 1)

next_cache = next_decoder_cache if use_cache else None

if not return_dict:
return tuple(v for v in [x, next_cache, all_hidden_states, all_self_attns] if v is not None)
return BaseModelOutputWithPast(
Expand Down
19 changes: 18 additions & 1 deletion src/transformers/modeling_tf_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
XLNetConfig,
replace_list_option_in_docstrings,
)
from .configuration_blenderbot import BlenderbotConfig
from .configuration_marian import MarianConfig
from .configuration_mbart import MBartConfig
from .configuration_pegasus import PegasusConfig
from .configuration_utils import PretrainedConfig
from .file_utils import add_start_docstrings
from .modeling_tf_albert import (
Expand All @@ -63,6 +67,7 @@
TFBertLMHeadModel,
TFBertModel,
)
from .modeling_tf_blenderbot import TFBlenderbotForConditionalGeneration
from .modeling_tf_camembert import (
TFCamembertForMaskedLM,
TFCamembertForMultipleChoice,
Expand Down Expand Up @@ -108,6 +113,8 @@
)
from .modeling_tf_gpt2 import TFGPT2LMHeadModel, TFGPT2Model
from .modeling_tf_longformer import TFLongformerForMaskedLM, TFLongformerForQuestionAnswering, TFLongformerModel
from .modeling_tf_marian import TFMarianMTModel
from .modeling_tf_mbart import TFMBartForConditionalGeneration
from .modeling_tf_mobilebert import (
TFMobileBertForMaskedLM,
TFMobileBertForMultipleChoice,
Expand All @@ -118,6 +125,7 @@
TFMobileBertModel,
)
from .modeling_tf_openai import TFOpenAIGPTLMHeadModel, TFOpenAIGPTModel
from .modeling_tf_pegasus import TFPegasusForConditionalGeneration
from .modeling_tf_roberta import (
TFRobertaForMaskedLM,
TFRobertaForMultipleChoice,
Expand Down Expand Up @@ -210,6 +218,7 @@
(T5Config, TFT5ForConditionalGeneration),
(DistilBertConfig, TFDistilBertForMaskedLM),
(AlbertConfig, TFAlbertForMaskedLM),
(MarianConfig, TFMarianMTModel),
(BartConfig, TFBartForConditionalGeneration),
(CamembertConfig, TFCamembertForMaskedLM),
(XLMRobertaConfig, TFXLMRobertaForMaskedLM),
Expand Down Expand Up @@ -261,8 +270,16 @@
]
)


TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING = OrderedDict(
[(T5Config, TFT5ForConditionalGeneration), (BartConfig, TFBartForConditionalGeneration)]
[
(T5Config, TFT5ForConditionalGeneration),
(MarianConfig, TFMarianMTModel),
(MBartConfig, TFMBartForConditionalGeneration),
(PegasusConfig, TFPegasusForConditionalGeneration),
(BlenderbotConfig, TFBlenderbotForConditionalGeneration),
(BartConfig, TFBartForConditionalGeneration),
]
)

TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING = OrderedDict(
Expand Down
Loading