Preserve tensor feature padding_value during serialization#92
Open
this-AR wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change ensures the
padding_valueof tensor features is included during schema serialization and restored when loading. This fixes losing custom padding values (e.g.-1) when saving and loading sequential datasets or tokenizers.Files changed
padding_valuein_get_object_argsand ensure_create_object_by_argspasses it toTensorFeatureInfo.test_tensor_schema_serialization_preserves_padding_value.Motivation
Previously custom padding values were not saved with tensor schema metadata and were reset to
0on load. This breaks workflows relying on non-zero padding sentinels.Backward compatibility
Older saved metadata without
padding_valueremains compatible becauseTensorFeatureInfodefaultspadding_valueto0.Tests
pytest -q tests/data/nn/test_schema.py::test_tensor_schema_serialization_preserves_padding_value \ tests/data/nn/test_sequential_dataset.py::test_save_and_load_sequential_dataset