Repository navigation
Restore ConcatThenSplitIterDataset from a JSON-serialized state - #1434
Open
AshishKumar4 wants to merge 1 commit into
Open
AshishKumar4 wants to merge 1 commit into
AshishKumar4 wants to merge 1 commit into
Conversation
A state read back from JSON holds the remainder slices as lists, which never equal the tuple sentinel _EMPTY_SLICE, so set_state took the next parent element as a sliced remainder and dropped it. _CtsState now holds the slices as tuples. test_checkpointing also restores through JSON.
This branch has not been deployed
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.
Fixes #1433.
_CtsStatemarks a missing (or whole, unsliced) remainder with the tuple_EMPTY_SLICE = (-1, -1). A state read back from JSON holds the slices as lists, which never equal that tuple, soset_statetook the next parent element as a remainder sliced[-1:-1]and dropped it._CtsState.__post_init__now holds the slices as tuples.test_checkpointinggainsthrough_json, which restores each checkpoint fromjson.loads(json.dumps(state)). With the fix, the module's tests pass (100 passed). Without it, the fourthrough_json=Truecases whose checkpoints include step 0 fail.📚 Documentation preview 📚: https://google-grain--1434.org.readthedocs.build/