check decoder_inputs_embeds is None before shifting labels (#19671)

This commit is contained in:
Arthur
2022-10-18 09:14:12 +02:00
committed by GitHub
parent d356b89f3c
commit 3e07196f89
21 changed files with 21 additions and 21 deletions

View File

@@ -2938,7 +2938,7 @@ class TF{{cookiecutter.camelcase_modelname}}ForConditionalGeneration(TF{{cookiec
if labels is not None:
use_cache = False
if decoder_input_ids is None:
if decoder_input_ids is None and decoder_inputs_embeds is None:
decoder_input_ids = shift_tokens_right(
labels, self.config.pad_token_id, self.config.decoder_start_token_id
)

View File

@@ -2833,7 +2833,7 @@ class {{cookiecutter.camelcase_modelname}}ForConditionalGeneration({{cookiecutte
if use_cache:
logger.warning("The `use_cache` argument is changed to `False` since `labels` is provided.")
use_cache = False
if decoder_input_ids is None:
if decoder_input_ids is None and decoder_inputs_embeds is None:
decoder_input_ids = shift_tokens_right(labels, self.config.pad_token_id, self.config.decoder_start_token_id)
outputs = self.model(