Unverified Commit 783b0dd5 authored by Jonathan Chang's avatar Jonathan Chang Committed by GitHub
Browse files

Fix t5 error message (#12136)

* Fix t5 error message

* Fix again
parent 3b1f5caf
...@@ -881,7 +881,7 @@ class T5Stack(T5PreTrainedModel): ...@@ -881,7 +881,7 @@ class T5Stack(T5PreTrainedModel):
if input_ids is not None and inputs_embeds is not None: if input_ids is not None and inputs_embeds is not None:
err_msg_prefix = "decoder_" if self.is_decoder else "" err_msg_prefix = "decoder_" if self.is_decoder else ""
raise ValueError( raise ValueError(
f"You cannot specify both {err_msg_prefix}inputs and {err_msg_prefix}inputs_embeds at the same time" f"You cannot specify both {err_msg_prefix}input_ids and {err_msg_prefix}inputs_embeds at the same time"
) )
elif input_ids is not None: elif input_ids is not None:
input_shape = input_ids.size() input_shape = input_ids.size()
...@@ -890,7 +890,7 @@ class T5Stack(T5PreTrainedModel): ...@@ -890,7 +890,7 @@ class T5Stack(T5PreTrainedModel):
input_shape = inputs_embeds.size()[:-1] input_shape = inputs_embeds.size()[:-1]
else: else:
err_msg_prefix = "decoder_" if self.is_decoder else "" err_msg_prefix = "decoder_" if self.is_decoder else ""
raise ValueError(f"You have to specify either {err_msg_prefix}inputs or {err_msg_prefix}inputs_embeds") raise ValueError(f"You have to specify either {err_msg_prefix}input_ids or {err_msg_prefix}inputs_embeds")
if inputs_embeds is None: if inputs_embeds is None:
assert self.embed_tokens is not None, "You have to initialize the model with valid token embeddings" assert self.embed_tokens is not None, "You have to initialize the model with valid token embeddings"
......
...@@ -625,7 +625,7 @@ class TFT5MainLayer(tf.keras.layers.Layer): ...@@ -625,7 +625,7 @@ class TFT5MainLayer(tf.keras.layers.Layer):
if inputs["input_ids"] is not None and inputs["inputs_embeds"] is not None: if inputs["input_ids"] is not None and inputs["inputs_embeds"] is not None:
err_msg_prefix = "decoder_" if self.is_decoder else "" err_msg_prefix = "decoder_" if self.is_decoder else ""
raise ValueError( raise ValueError(
f"You cannot specify both {err_msg_prefix}inputs and {err_msg_prefix}inputs_embeds at the same time" f"You cannot specify both {err_msg_prefix}input_ids and {err_msg_prefix}inputs_embeds at the same time"
) )
elif inputs["input_ids"] is not None: elif inputs["input_ids"] is not None:
input_shape = shape_list(inputs["input_ids"]) input_shape = shape_list(inputs["input_ids"])
...@@ -634,7 +634,7 @@ class TFT5MainLayer(tf.keras.layers.Layer): ...@@ -634,7 +634,7 @@ class TFT5MainLayer(tf.keras.layers.Layer):
input_shape = shape_list(inputs["inputs_embeds"])[:-1] input_shape = shape_list(inputs["inputs_embeds"])[:-1]
else: else:
err_msg_prefix = "decoder_" if self.is_decoder else "" err_msg_prefix = "decoder_" if self.is_decoder else ""
raise ValueError(f"You have to specify either {err_msg_prefix}inputs or {err_msg_prefix}inputs_embeds") raise ValueError(f"You have to specify either {err_msg_prefix}input_ids or {err_msg_prefix}inputs_embeds")
if inputs["inputs_embeds"] is None: if inputs["inputs_embeds"] is None:
assert self.embed_tokens is not None, "You have to initialize the model with valid token embeddings" assert self.embed_tokens is not None, "You have to initialize the model with valid token embeddings"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment