Skip to content

Preserve GLM-5.2 Megatron accuracy-compatible specs - #3

Draft
zrr1999 wants to merge 22 commits into
PFCCLab:mainfrom
zrr1999:glm52-bit-exact-alignment
Draft

Preserve GLM-5.2 Megatron accuracy-compatible specs#3
zrr1999 wants to merge 22 commits into
PFCCLab:mainfrom
zrr1999:glm52-bit-exact-alignment

Conversation

@zrr1999

@zrr1999 zrr1999 commented Jul 27, 2026

Copy link
Copy Markdown

Scope

ms-swift accuracy-compatible TE-off: after forcing local decoder/MTP specs, also replace _get_backend_spec_provider with LocalSpecProvider so DSA indexer / MLA are not still built as TELinear/TENorm.

Evidence

  • E-259: leftover DSA TE moved post_attn_norm 29/30 → 5/30; Paddle HAVE_TE is False.
  • Focused test (venv venvs/torch/bin/python, venv cuDNN first): tests/megatron/test_model_config.py::test_dsa_backend_forced_to_local_spec_when_accuracy_compatible — 1 passed.

Gate state

Not accepted. Source freeze blocked. This PR's evidence is probe-class and does not advance a gate.

Blocked by

  • contract_environment.source-freeze-head-vs-pin
  • acceptance_oracle.torch-results-checkpoint-empty

Not verified

  • Default TE-on path (patch runs only when use_accuracy_compatible is on).
  • Formal 100-step invocation.

zrr1999 added 22 commits July 22, 2026 22:18
Resolve swift/megatron/init.py: keep both _patch_mcore_bridge additions. Upstream main added the import-time use_accuracy_compatible TE-off patch; this branch added the norm_accuracy_compatible DSA q/kv layernorm spec patch. They are independent and both are applied, TE-off first.
_replace_spec_dsa otherwise still asks TESpecProvider, leaving TELinear
on indexer/MLA while Paddle HAVE_TE is False.
Stack-top dump-off YAML uses those keys. Without the dataclass fields
parse_args left remaining_argv and failed closed. Alias MTP depth onto
mtp_num_layers and apply the Megatron deterministic contract at init.
TE-off local TransformerLayer has a standalone pre_mlp_layernorm,
not fused linear_fc1.layer_norm_weight. Weight load asserted None
on that fused key. Route the HF post-attention LN onto the local
module when the fused parameter is absent.
TP2+SP pads ceil(57/2)*2=58 without the extra *2, while PaddleFleet and
the E-811 IEEE 1-100 carrier are 60. Restore the SP interleave factor so
get_padding_to is 4 on the frozen profile.

Signed-off-by: Zhan Rongrui <me@zrr.dev>
CI flake8/isort/yapf on PFCCLab#3 failed on the new test
imports and nearby wrap. Numerics unchanged.

Signed-off-by: Zhan Rongrui <me@zrr.dev>
Merge PFCCLab/ms-swift main so lint --all-files includes the new
alignment workflow and build.sh. Wrap the two E501 lines in the
observability trainer helpers and let isort/yapf/single-quote
hooks rewrite only files already on this branch.
CI pre-commit --all-files still ran double-quote-string-fixer on
utils.py after the main merge. Local --all-files is now green.
The previous quote-fixer pass rewrote rf'({"|".join(...)})' to
' | ', which would change the regex. Restore the original
alternation and only single-quote the dump/load helper strings
that CI's double-quote-string-fixer still rewrote.
CI lint uses Python 3.10, whose tokenize still sees f"..." as
STRING tokens, so double-quote-string-fixer rewrites them. Local
3.12 tokenize splits f-strings and the hook no-ops. Convert the
four logger f-strings and one comment on this branch.
Self-hosted unittest died at sudo chown with "no tty present and no
askpass". Keep chown when sudo -n works; otherwise skip so checkout can run.
Keep pull_request on the historical CodeSync/develop tarball and
develop/latest wheels. workflow_dispatch can opt into fail-closed
SHA checkout plus artifact digest checks; pairing remains unproven
unless this job built the wheels from the pin. MinimaxV2.5_EP2 and
GLM45Air_EP2 are unchanged.
paddle-4 runner 2.337.0 forces Node 24 for actions/checkout@v3;
node24 needs GLIBC 2.27/2.28 which this host lacks (job 101275701451).
Keep checkout@v3 and opt into ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION.
Match Megatron PFCCLab#4: checkout COMMIT_ID on workflow_dispatch, export
source trees from the pin selector, and consume that env in the
alignment step so setup_venvs never sees the hardcoded 0.0.0 wheel.
Match Megatron PFCCLab#4: caller mode/pin stay authoritative; unproven develop
fallback is refused; verified 0.0.0 names remain legal.
Selector clone failure must fail the docker exec (set -e) instead of
continuing wget/build. Receipt checks live in a helper so the
single-quoted -c script has no nested quotes. Missing pin.env after an
error receipt is selector failure, not env-handoff.
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