fix(checkpointing): raise RuntimeError on fatal checkpointing errors - #4927
Open
RexBearIU wants to merge 1 commit into
Open
fix(checkpointing): raise RuntimeError on fatal checkpointing errors#4927RexBearIU wants to merge 1 commit into
RexBearIU wants to merge 1 commit into
Conversation
RexBearIU
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
richjames0,
shralex,
shuningjin,
vipannalla and
xibinliu
as code owners
August 18, 2026 08:12
There was a problem hiding this comment.
Code Review
This pull request modifies the checkpoint error handler in checkpointing.py to only raise a StopTraining exception when elastic training is enabled, and otherwise re-raise the original error. The reviewer suggests using elastic_utils.elastic_enabled(config) instead of checking config.elastic_enabled directly to ensure consistency and avoid unexpected behavior when the job is not running in an elastic environment.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
RexBearIU
force-pushed
the
jackyf/fix-checkpoint-silent-failure
branch
3 times, most recently
from
August 19, 2026 07:56
f1aab5b to
89ff3ee
Compare
SurbhiJainUSC
approved these changes
Aug 19, 2026
RexBearIU
force-pushed
the
jackyf/fix-checkpoint-silent-failure
branch
from
August 21, 2026 08:01
89ff3ee to
3b59c51
Compare
abhinavclemson
approved these changes
Aug 21, 2026
RexBearIU
force-pushed
the
jackyf/fix-checkpoint-silent-failure
branch
from
August 21, 2026 08:25
3b59c51 to
5089d22
Compare
RexBearIU
force-pushed
the
jackyf/fix-checkpoint-silent-failure
branch
from
August 21, 2026 08:53
5089d22 to
3626e0c
Compare
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.
Description
When checkpointing encounters an unexpected runtime or I/O failure,
_checkpoint_error_handlerpreviously converted the exception intoexceptions.StopTraining(...).In
train.py, allStopTrainingexceptions are treated as graceful completions (_job_completed_gracefully = True), which causes the Python process to exit with status code0(success). This silently masks fatal checkpointing failures from upstream orchestration tools (such as Airflow DAGs, SLURM scripts, and CI runners), causing subsequent pipeline stages (like evaluation or decode) to fail cryptically with missing checkpoint errors.Fix
_checkpoint_error_handlerinsrc/maxtext/common/checkpointing.pyto raiseRuntimeError(f"Checkpointing failed. {str(err)}") from errdirectly on unexpected errors.JaxRuntimeError,ScaleUpSignalError) continue to be bubbled up upstream viacheckpoint_exception_guard.from err.tests/unit/checkpointing_test.pyto verifyRuntimeErrorraising and exception chaining (__cause__).Tests
codespell,pylint,pyink,mdformat,yamllint,actionlint(all passed on diff files)tests/unit/checkpointing_test.py(13 tests passed)Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.