Fix: Overhaul WAN checkpointers for robust multi-host restoration#379
Merged
copybara-service[bot] merged 1 commit intomainfrom Apr 17, 2026
Merged
Fix: Overhaul WAN checkpointers for robust multi-host restoration#379copybara-service[bot] merged 1 commit intomainfrom
copybara-service[bot] merged 1 commit intomainfrom
Conversation
09deaaa to
4850947
Compare
entrpn
previously approved these changes
Apr 16, 2026
4850947 to
68d7f5d
Compare
This commit resolves several interrelated checkpointing issues by updating how Orbax handles metadata, sharding, and PyTree restoration. Key changes: * Add explicit `item_handlers`: Defined specific handlers (`JsonCheckpointHandler` for configs, `StandardCheckpointHandler` for states) in `CheckpointManager`. This ensures metadata is restored correctly, resolving known Orbax limitations (reference: google/orbax#986). * Bypass mesh validation during restore: Replaced `ocp.utils.to_shape_dtype_struct` with manual `jax.ShapeDtypeStruct` construction in `add_sharding_to_struct`. This makes restoration topology-agnostic, preventing `ValueError` when the current device mesh has fewer devices than the saved checkpoint's topology (e.g., restoring 32-device metadata on 4 devices). * Migrate to Standard API: Upgraded all WAN checkpointers from the `PyTreeSave`/`PyTreeRestore` APIs to `StandardSave`/`StandardRestore` to align with `item_handlers` defined in CheckpointManager. Co-authored-by: martinarroyo <martinarroyo@google.com>
68d7f5d to
69f7701
Compare
entrpn
approved these changes
Apr 17, 2026
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.
This commit resolves several interrelated checkpointing issues by updating how Orbax handles metadata, sharding, and PyTree restoration.
Key changes:
Add explicit
item_handlers: Defined specific handlers (JsonCheckpointHandlerfor configs,StandardCheckpointHandlerfor states) inCheckpointManager. This ensures metadata is restored correctly, resolving known Orbax limitations (reference: Restoring to CPU google/orbax#986).Bypass mesh validation during restore: Replaced
ocp.utils.to_shape_dtype_structwith manualjax.ShapeDtypeStructconstruction inadd_sharding_to_struct. This makes restoration topology-agnostic, preventingValueErrorwhen the current device mesh has fewer devices than the saved checkpoint's topology (e.g., restoring 32-device metadata on 4 devices).Migrate to Standard API: Upgraded all WAN checkpointers from the
PyTreeSave/PyTreeRestoreAPIs toStandardSave/StandardRestoreto align withitem_handlersdefined in CheckpointManager.