Skip to content

Add Orbax v1 StatefulCheckpointable for MaxText grain iterators.#4380

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_944311355
Open

Add Orbax v1 StatefulCheckpointable for MaxText grain iterators.#4380
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_944311355

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Add Orbax v1 StatefulCheckpointable for MaxText grain iterators.

This change introduces grain_utility.py, which provides a GrainCheckpointable class for handling checkpointing of various data iterator types used in MaxText. It supports standard grain iterators, ElasticIterator, RemoteIteratorWrapper, and lists of iterators for data scaling. The module includes for_save and for_restore factory functions to build the appropriate GrainCheckpointable instance based on the iterator type and configuration.

This is supposed to be 1:1 with the original grain checkpoint handler logic, the v0 logic is marked for removal once cl/929057022 lands as distillation_utils is seemingly the only other component which utilizes this handler.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.12803% with 95 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/maxtext/common/grain_utility.py 62.70% 78 Missing and 13 partials ⚠️
src/maxtext/common/checkpointing.py 77.77% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@copybara-service copybara-service Bot force-pushed the test_944311355 branch 4 times, most recently from 3eda94c to 01166c5 Compare July 8, 2026 20:29
This change introduces `grain_utility.py`, which provides a `GrainCheckpointable` class for handling checkpointing of various data iterator types used in MaxText. It supports standard grain iterators, ElasticIterator, RemoteIteratorWrapper, and lists of iterators for data scaling. The module includes `for_save` and `for_restore` factory functions to build the appropriate `GrainCheckpointable` instance based on the iterator type and configuration.

This is supposed to be 1:1 with the original grain checkpoint handler logic, the v0 logic is marked for removal once cl/929057022 lands as distillation_utils is seemingly the only other component which utilizes this handler.

PiperOrigin-RevId: 944311355
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