Skip to content

Add standalone checkpointer benchmark features and Orbax configuratio… - #4698

Open
Marlon666 wants to merge 1 commit into
AI-Hypercomputer:mainfrom
Marlon666:feature/tessellation-benchmark-migration
Open

Add standalone checkpointer benchmark features and Orbax configuratio…#4698
Marlon666 wants to merge 1 commit into
AI-Hypercomputer:mainfrom
Marlon666:feature/tessellation-benchmark-migration

Conversation

@Marlon666

Copy link
Copy Markdown

Description

This PR introduces first-class configuration capabilities to standalone_checkpointer.py and Orbax checkpointing managers to natively support downstream checkpoint storage benchmarking without requiring file overwriting. See b/540420675 for more of the details

How this is a change from the past & Problem being solved

Previously, downstream benchmarking repositories (such as Tessellations) had to manually override 6 core MaxText Python/YAML files using Docker COPY commands to inject custom checkpointing benchmark behavior (e.g., save + restore loop, interval delays, cache dropping, and Orbax sharding parameters). This approach caused fragility and code drift whenever upstream MaxText refactored its codebase.

This PR eliminates the need for file overwriting by turning these benchmarking requirements into first-class, optional configuration flags in upstream MaxText. Downstream users can now directly use the stable public MaxText Docker image.

Specific Implementation Details

  1. Config Schema (src/maxtext/configs/types.py & src/maxtext/configs/base.yml):
    • Added checkpoint_save_use_replica_parallel, checkpoint_storage_pytree_chunk_size_bytes, per_step_interval, drop_page_cache_before_restore, and standalone_checkpointer_enable_restore_in_loop.
    • All flags default to safe values (None, 0.0, or False) in base.yml to guarantee zero breaking changes to existing MaxText workloads.
  2. Orbax Storage & Sharding Wiring (src/maxtext/common/checkpointing.py & src/maxtext/utils/train_utils.py):
    • Wired checkpoint_save_use_replica_parallel into create_orbax_checkpoint_manager to register JAX ArrayHandler and SingleReplicaArrayHandler with replica parallel support.
    • Supported custom checkpoint_storage_pytree_chunk_size_bytes override in ocp.args.PyTreeSave while decoupling target file size (ocdbt_target_data_file_size) from array chunking size (chunk_byte_size).
    • Added standard TODO tracking comments (TODO(b/536987093): Validate Orbax upstream API changes before closing bug.).
  3. Standalone Checkpointer Loop Refactoring (src/maxtext/utils/standalone_checkpointer.py):
    • Removed deprecated legacy GCS CSV metric uploads (metrics are now collected by independent downstream evaluators).
    • Merged consecutive if jax.process_index() == 0: blocks for clean logging and interval sleep (per_step_interval), backed by full-cluster barrier synchronization (sync_global_devices).
    • Added optional Linux OS page cache eviction (sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches') and checkpoint restoration under if config.standalone_checkpointer_enable_restore_in_loop:.

BUGS: b/540420675, b/536987093

Tests

  • Syntax & AST Verification: Tested via python3 -m py_compile across all 5 modified files (types.py, base.yml, checkpointing.py, train_utils.py, standalone_checkpointer.py) with zero syntax or linter errors (git diff --check).
  • Backward Compatibility & Automated Upstream CI: Verified that because all new options default to legacy upstream behavior (standalone_checkpointer_enable_restore_in_loop=False, drop_page_cache_before_restore=False), existing checkpointing regression tests (tests/unit/checkpointing_test.py, end_to_end/test_checkpointing.sh) continue to pass without any breaking changes.
  • Reproduction / Downstream Benchmark Verification:
    To exercise the bidirectional Save + Wait + Cache Eviction + Restore storage benchmark loop:
    python3 -m maxtext.utils.standalone_checkpointer \
      per_step_interval=30.0 \
      standalone_checkpointer_enable_restore_in_loop=True \
      drop_page_cache_before_restore=True \
      checkpoint_save_use_replica_parallel=True \
      checkpoint_storage_pytree_chunk_size_bytes=536870912
    

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • [ X ] I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • [ X] I have necessary comments in my code, particularly in hard-to-understand areas.
  • [ X] I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

…n flags

- Add checkpoint_save_use_replica_parallel and checkpoint_storage_pytree_chunk_size_bytes
  configuration flags to types.py and base.yml (tracked by b/536987093).
- Wire checkpoint_save_use_replica_parallel through create_orbax_checkpoint_manager
  and register Orbax ArrayHandler/SingleReplicaArrayHandler with replica parallel support.
- Support custom PyTree chunk size bytes override during checkpoint saving.
- Add per_step_interval and drop_page_cache_before_restore configuration flags for
  standalone checkpointer storage benchmarking.
- Update standalone_checkpointer.py loop to execute save, optional interval wait,
  optional Linux OS page cache eviction, and restore on each step iteration.
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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.

1 participant