Skip to content
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,7 @@ def forward(
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you
provide it.

Indices can be obtained using :class:`~transformers.BigBirdPegasusTokenizer`. See
Indices can be obtained using :class:`~transformers.PegasusTokenizer`. See
:meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__`
for details.

Expand Down Expand Up @@ -2862,7 +2862,7 @@ def forward(self, *args, **kwargs):
return self.decoder(*args, **kwargs)


# Copied from transformers.models.bart.modeling_bart.BartForCausalLM with Bart->BigBirdPegasus, 'facebook/bart-large'->"google/bigbird-pegasus-large-arxiv"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't keep copy here, because there is no BigBirdPegasusTokenizer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we try to keep the copy and change Bart->BigBirdPegasus to BartDecoderWrapper->BigBirdPegasusDecoderWrapper and BartForCausalLM->BigBirdPegasusForCausalLM? This way the tokenizer should stay the same :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following does the trick:

  • BartDecoderWrapper->BigBirdPegasusDecoderWrapper
  • BartForCausalLM->BigBirdPegasusForCausalLM
  • BartPreTrainedModel->BigBirdPegasusPreTrainedModel
  • BartTokenizer->PegasusTokenizer
  • 'facebook/bart-large'->"google/bigbird-pegasus-large-arxiv"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect!

# Copied from transformers.models.bart.modeling_bart.BartForCausalLM with BartDecoderWrapper->BigBirdPegasusDecoderWrapper, BartForCausalLM->BigBirdPegasusForCausalLM, BartPreTrainedModel->BigBirdPegasusPreTrainedModel, BartTokenizer->PegasusTokenizer, 'facebook/bart-large'->"google/bigbird-pegasus-large-arxiv"
class BigBirdPegasusForCausalLM(BigBirdPegasusPreTrainedModel):
def __init__(self, config):
super().__init__(config)
Expand Down Expand Up @@ -2917,7 +2917,7 @@ def forward(
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you
provide it.

Indices can be obtained using :class:`~transformers.BigBirdPegasusTokenizer`. See
Indices can be obtained using :class:`~transformers.PegasusTokenizer`. See
:meth:`transformers.PreTrainedTokenizer.encode` and :meth:`transformers.PreTrainedTokenizer.__call__`
for details.

Expand Down Expand Up @@ -2985,9 +2985,9 @@ def forward(

Example::

>>> from transformers import BigBirdPegasusTokenizer, BigBirdPegasusForCausalLM
>>> from transformers import PegasusTokenizer, BigBirdPegasusForCausalLM

>>> tokenizer = BigBirdPegasusTokenizer.from_pretrained("google/bigbird-pegasus-large-arxiv")
>>> tokenizer = PegasusTokenizer.from_pretrained("google/bigbird-pegasus-large-arxiv")
>>> model = BigBirdPegasusForCausalLM.from_pretrained("google/bigbird-pegasus-large-arxiv", add_cross_attention=False)
>>> assert model.config.is_decoder, f"{model.__class__} has to be configured as a decoder."
>>> inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
Expand Down