Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make error message a bit more helpful and actionable. #762

Merged
merged 1 commit into from
Sep 26, 2024
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
9 changes: 5 additions & 4 deletions seqio/feature_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,9 @@ def _validate_dataset(
for feat in expected_features:
if feat not in element_spec:
raise ValueError(
"Dataset is missing an expected feature during "
f"{error_label} validation: '{feat}'"
"Dataset is missing an expected feature during"
f" {error_label} validation: '{feat}'. Received {element_spec},"
f" expected {expected_features}."
)

if expected_features[feat].dtype != element_spec[feat].dtype:
Expand Down Expand Up @@ -759,7 +760,7 @@ def _convert_features(
"""

def convert_example(
features: Mapping[str, tf.Tensor]
features: Mapping[str, tf.Tensor],
) -> Mapping[str, tf.Tensor]:
# targets_segment_id is present only for a packed dataset.
decoder_input_tokens = utils.make_autoregressive_inputs(
Expand Down Expand Up @@ -1540,7 +1541,7 @@ def _convert_features(

@utils.map_over_dataset
def convert_example(
features: Mapping[str, tf.Tensor]
features: Mapping[str, tf.Tensor],
) -> Mapping[str, tf.Tensor]:
inputs = features["inputs"]
d = {
Expand Down
Loading