Skip to content

fix(glm5_next): align Core mHC configuration and config copying - #246

Open
WangKangAandy wants to merge 2 commits into
modelscope:mainfrom
WangKangAandy:fix/glm5-next-core-config
Open

WangKangAandy wants to merge 2 commits into
modelscope:mainfrom
WangKangAandy:fix/glm5-next-core-config

Conversation

@WangKangAandy

@WangKangAandy WangKangAandy commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary

Align GLM-5.3-Flash (glm5_next) configuration with the mHC fields and per-layer configuration copying used by the target Megatron Core main snapshot.

  • Set enable_mhc_connections / mhc_num_residual_streams when Core exposes the enable field, and disable mHC on MTP's copied configuration without changing the backbone configuration.
  • Keep the bridge shared during deepcopy, consistent with ModelConfig.__deepcopy__, so copying config.__dict__ does not traverse its process groups.

Published checkpoint mappings remain unchanged.

Compatibility

Core main introduced these mHC fields in #4531; they differ from the earlier dev/HybridModel enable_hyper_connections interface. #6313 introduced the per-layer from_config() path that copies config.__dict__ directly.

Target: Transformers 5.16.1 and Megatron-LM 01ac4e83 from source. Model construction on that snapshot also needs mcore-bridge #245; the focused tests below do not. Field detection does not supply missing GLM hybrid implementations in other Core versions.

Validation

python -m pytest -q tests/test_glm5_next.py \
  -k "parser_preserves or deepcopy_shares or mtp_layer_disables or mtp_layer_is_filtered"

4 passed, 43 deselected on Python 3.12 with the target Core. Tests cover mHC configuration, sharing the bridge during deepcopy, disabling mHC on MTP's configuration copy, and MTP weight filtering. Whitespace checks pass.

These tests isolate configuration and copy behavior without constructing models or process groups. Full training, checkpoint round-trip, and a real Core-version runtime matrix have not been validated for this change.

@WangKangAandy WangKangAandy changed the title fix(glm5_next): align router and Core mHC configuration fix(glm5_next): align Core mHC configuration and config copying Oct 30, 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.

1 participant