Skip to content

Commit

Permalink
Bart can make decoder_input_ids from labels (huggingface#6758)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshleifer authored and fabiocapsouza committed Nov 15, 2020
1 parent 07d0a53 commit f53d5ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transformers/modeling_bart.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"facebook/bart-large-cnn",
"facebook/bart-large-xsum",
"facebook/mbart-large-en-ro",
# See all BART models at https://huggingface.co/models?filter=bart
]
# This list is incomplete. See all BART models at https://huggingface.co/models?filter=bart


BART_START_DOCSTRING = r"""
Expand Down Expand Up @@ -1045,6 +1045,8 @@ def forward(

if labels is not None:
use_cache = False
if decoder_input_ids is None:
decoder_input_ids = shift_tokens_right(labels, self.config.pad_token_id)

outputs = self.model(
input_ids,
Expand Down

0 comments on commit f53d5ad

Please sign in to comment.