Allow identical config overrides and handle configuration exceptions …#3933
Merged
Conversation
shralex
requested review from
A9isha,
NicoGrande,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
igorts-git,
jesselu-google,
jiangjy1982,
khatwanimohit,
richjames0,
suexu1025 and
vipannalla
as code owners
May 18, 2026 15:05
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
NuojCheng
approved these changes
May 18, 2026
…cleanly with code 2 and Kubernetes termination logging
SurbhiJainUSC
approved these changes
May 18, 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.
…cleanly with code 2 and Kubernetes termination logging
This PR addresses two issues in MaxText's configuration initialization and validation:
Previously, calling a model config with a command-line override would hard-reject the execution if the key was defined by both, even if the provided override value was completely identical (such as tokenizer_type="huggingface" when running qwen3 models). This PR modifies validate_no_keys_overridden_twice to compare the resolved values. Overrides are now allowed if the override value matches the model configuration value exactly. A ValueError is only raised if the values differ and override_model_config=False.
When a deterministic config validation error occurs during startup, JobSet/Kubernetes would previously crash-loop and exhaust maxRestarts because config validation errors looked like infrastructure/general flakes (exiting with code 1).
This PR catches configuration validation errors, prints a highly visible error banner to sys.stderr, writes the specific failure message to /dev/termination-log for Kubernetes status propagation, and exits with standard exit code 2 (reserved for CLI syntax and config errors). Standard behavior is bypassed when running in test environments (pytest/unittest) to allow original validation exceptions to propagate for assertions.
Tests
Tested on TPU VM
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.