Skip to content

fix(glm5): support FP8 context-parallel launches - #17

Closed
JackRao123 wants to merge 7 commits into
trainers-main-20260907from
jackrao/glm-cp-bridge-20260907
Closed

fix(glm5): support FP8 context-parallel launches#17
JackRao123 wants to merge 7 commits into
trainers-main-20260907from
jackrao/glm-cp-bridge-20260907

Conversation

@JackRao123

@JackRao123 JackRao123 commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Prepare the GLM-5.2 FP8 Bridge path for the 131k context-parallel trainer:

  • Vectorize blockwise FP8 checkpoint dequantization without changing results.
  • Load the raw GLM config from a local snapshot or the Hugging Face cache when base_model is a hub ID, and fail before conversion if it is unavailable. The raw config preserves the qk head-dimension split required for valid weight shapes.
  • Pin 3rdparty/Megatron-LM to Megatron-LM#14 (a1fab1bb), which fixes packed-CP DSA indexer causal-mask alignment.

Validation

  • FP8 dequantization is bit-exact against the previous per-block implementation.
  • Raw-config coverage includes hub-ID resolution.
  • The dependent GLM-5.2 FP8 CP32 131k LoRA run completed with exact indexer parity, finite gradients, and decreasing loss.

Integration target and merge order

The deleted trainers-main-20260907 target has been replaced by trainers-main at the identical base commit (8e2d2db), so this branch needs no rebase.

This PR and Megatron-LM#14 can be reviewed in parallel, but merge LM#14 first. If LM#14 is squash- or rebase-merged, this branch will repin 3rdparty/Megatron-LM to the landed LM trainers-main SHA before it merges. Trainers will then advance its Bridge gitlink.

Dependency

Merge Megatron-LM#14 before this PR; the pinned commit is its current head.

Comment on lines +120 to +121
logger.warning(
"Skipping the GLM-5 qk head-dim workaround (raw config.json "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets just error in this case

JackRao123 and others added 3 commits July 11, 2026 17:45
The per-block Python loop made GLM-5.2-FP8's 800B load CPU-bound
(8 workers pegged ~50 min). Two repeat_interleaves + one multiply,
verified bit-exact against the loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The qk_rope_head_dim workaround (transformers GlmMoeDsaConfig collapses
the qk head-dim split, corrupting kv_a_proj shapes: 704 != 576) only
read <base_model>/config.json as a filesystem path, so it silently
no-opped when base_model is a hub repo id and the 800B weight load
failed. Resolve the raw config through hf_hub_download when the local
read misses — transformers has already cached config.json by the time
the bridge runs, so this works offline (HF_HUB_OFFLINE) too. Warn
loudly when neither path resolves.

Prod launches GLM-5.2-FP8 by HF id, so this unblocks the registry row
in trainers#592.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JackRao123 and others added 3 commits July 13, 2026 11:00
Keep the Bridge submodule aligned with the current LM#14 head before the
dependent Bridge and Trainers PRs merge.

Signed-off-by: Jack Rao <jack.rao@baseten.co>
The raw config preserves GLM qk dimensions, so conversion must terminate
instead of continuing with invalid MLA shapes. Remove redundant comments.

Signed-off-by: Jack Rao <jack.rao@baseten.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the Bridge submodule aligned with the current LM#14 head before the
dependent PRs merge.

Signed-off-by: Jack Rao <jack.rao@baseten.co>
@JackRao123 JackRao123 changed the title GLM-5.2 productionization: hub-id raw-config fix, vectorized FP8 dequant, LM q_causal_offsets repin fix(glm5): support FP8 context-parallel launches Jul 13, 2026
State the Transformer configuration defect and why the raw config is required.

Signed-off-by: Jack Rao <jack.rao@baseten.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
@pstefa1707
pstefa1707 deleted the branch trainers-main-20260907 July 13, 2026 20:50
@pstefa1707 pstefa1707 closed this Jul 13, 2026
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.

2 participants