[codex] Port Gemma4 PR1855 training fixes#2
Draft
EazyReal wants to merge 1 commit into
Draft
Conversation
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.
What changed
Ports the upstream-shaped Gemma4 training fixes from the internal v031 integration work onto PR1855 without pulling in Vmax agent/launcher/retry glue.
[q, k]means global K=V geometry,[q, k, v]means sliding/local geometry. This covers pipeline-parallel imports where a local Megatron layer name can otherwise look like layer 0.Why
The internal bringup found that PR1855’s model path was mostly structurally complete, but training/export still needed narrow fixes around QKV import shape selection and softcap memory pressure. The other internal commits named in the audit map to behavior already present in PR1855’s larger native implementation: concatenated dual-RoPE with packed kwargs, explicit pre-MLP norm, dense MLP without padding-mask forwarding, SDPA/flash CP attention, and config-local layer shape overrides.
Validation
Passed:
uv run --python 3.12 --with ruff ruff check slime_plugins/mbridge/gemma4.py slime_plugins/models/gemma4_provider.py tests/gemma4/test_gemma4_qkv_roundtrip.py tests/gemma4/test_gemma4_provider.py tests/gemma4/test_gemma4_dual_rope.pygit diff --checkuv run --python 3.12 --with torch --with numpy python -m py_compile slime_plugins/mbridge/gemma4.py slime_plugins/models/gemma4_provider.py tests/gemma4/test_gemma4_qkv_roundtrip.py tests/gemma4/test_gemma4_provider.py tests/gemma4/test_gemma4_dual_rope.pyCould not run full targeted pytest locally because this checkout environment does not have external
mbridgeormegatronpackages available; collection stops before executing tests withModuleNotFoundError: No module named 'mbridge'/No module named 'megatron'.