Add decoder specific error message for T5Stack.forward (#4128)

This commit is contained in:
Lorenzo Ampil
2020-05-03 18:40:08 +08:00
committed by GitHub
parent 1cdd2ad2af
commit 6af3306a1d

View File

@@ -665,6 +665,9 @@ class T5Stack(T5PreTrainedModel):
input_ids = input_ids.view(-1, input_shape[-1]) input_ids = input_ids.view(-1, input_shape[-1])
elif inputs_embeds is not None: elif inputs_embeds is not None:
input_shape = inputs_embeds.size()[:-1] input_shape = inputs_embeds.size()[:-1]
else:
if self.is_decoder:
raise ValueError("You have to specify either decoder_input_ids or decoder_inputs_embeds")
else: else:
raise ValueError("You have to specify either input_ids or inputs_embeds") raise ValueError("You have to specify either input_ids or inputs_embeds")