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

Orbax no longer supports lazy restoration of checkpoints. #1340

Merged
merged 0 commits into from
Jul 28, 2023

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Jul 17, 2023

Orbax no longer supports lazy restoration of checkpoints.

If our checkpoint is {'a': 2, 'b': 4}, and we wish to 'lazily' load the tree such that only 'a' is materialized, equivalent functionality can be achieved using the following:

ckptr = ocp.PyTreeCheckpointer()
tree = {'a': <dummy_value>, 'b': <dummy_value>}
ckptr.restore(path, item=tree, transforms={'b': ocp.Transform(use_fallback=True)})
{'a': 2, 'b': <dummy_value>}

OR

ckptr = ocp.PyTreeCheckpointer()
tree = {'a': <dummy_value>}
# Returns a tree just containing 'a', materialized.
ckptr.restore(path, item=tree, transforms={})
{'a': 2}

Previously this could have also been done with the lazy feature:

ckptr = ocp.PyTreeCheckpointer()
ckptr.restore(path, restore_args={'a': RestoreArgs(), 'b': RestoreArgs(lazy=True)})
{'a': 2, 'b': LazyValue()} 

@copybara-service copybara-service bot force-pushed the test_547941035 branch 5 times, most recently from 6e061b4 to 831342f Compare July 18, 2023 20:41
@copybara-service copybara-service bot force-pushed the test_547941035 branch 7 times, most recently from de97cb2 to 13b00c9 Compare July 27, 2023 16:58
@copybara-service copybara-service bot closed this Jul 28, 2023
@copybara-service copybara-service bot merged commit a9b8f15 into main Jul 28, 2023
1 check passed
@copybara-service copybara-service bot deleted the test_547941035 branch July 28, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants