Skip to content

fix(glm5_next): probe KDA fields on the hybrid layer config - #245

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

WangKangAandy wants to merge 2 commits into
modelscope:mainfrom
WangKangAandy:fix/glm5-next-kda-probe

Conversation

@WangKangAandy

Copy link
Copy Markdown

Problem

NVIDIA/Megatron-LM#7054 added GLM-style KDA hybrid layers. Its merged implementation:

require_glm5_hybrid() only checks TransformerConfig.__dataclass_fields__, so it incorrectly rejects this supported layout and tells users to apply the Megatron patch.

Fix

When kda_two_stage_gates is absent from TransformerConfig, also check the config selected by LAYER_CONFIG_MAP['K']. Preserve support for the legacy field layout and continue rejecting missing required capabilities.

Tests

Parameterized unit tests in tests/test_glm5_next.py cover the legacy layout, the KDA-layer layout, a field missing from both, an unavailable layer-config module, and an unrelated required field still missing. They exercise the real guard with mocked config metadata, without constructing a model or process group.

  • PR implementation: 5 passed.
  • Changed files pass the repository-pinned flake8, isort, and YAPF checks.
  • Pre-fix guard: 1 failed, 4 passed; the KDA-layer-only case reproduces the original rejection.
python -m pytest -q tests/test_glm5_next.py -k hybrid_guard_kda_config_locations

@hjh0119

hjh0119 commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Does this also happen on dev? We don't currently aim for Megatron main branch compatibility

@xallor-agent

Copy link
Copy Markdown

Does this also happen on dev? We don't currently aim for Megatron main branch compatibility
@hjh0119
No — not on current NVIDIA dev. The false reject is the post-#7054 main layout (kda_two_stage_gates on KDALayerConfig only). Current dev still uses the empty KDALayerConfig alias; official unpatched dev still needs the packaged TransformerConfig patch. #245 is forward-compat for when dev absorbs that main change; it is a no-op on today's dev.

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.

3 participants