[model] fix: adapt MCore dev attention gates#4326
Open
yaoyu-33 wants to merge 2 commits into
Open
Conversation
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Contributor
Author
|
/ok to test 08e24e7 |
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.
Summary
Fixes the MCore dev bump failure from #4324.
Target:
devClassification: MCore broke Bridge
Root cause: MCore dev commit range for the 2026-06-12 automated bump adds native head-wise attention gate support. MCore now passes
head_wise_gate=into attention QKV helpers and rejects configurations that enable bothhead_wise_attn_gateandattention_output_gate. Bridge's DiT attention override did not accept the new keyword, and Step-3.5 conversion still requested the older expandedattention_output_gatelayout when native scalar gates were available.Fix
head_wise_gatein DiT self/cross attention QKV helpers while keeping unsupported true-gate behavior guarded.head_wise_gate.head_wise_attn_gatelayout for Step-3.5 when the active MCoreTransformerConfigsupports it, while preserving the olderattention_output_gatefallback otherwise.Guards
Added:
head_wise_gate=Trueguard with TODO to remove when DiT attention supports MCorehead_wise_attn_gaterows.head_wise_gatekeyword.head_wise_attn_gateand Bridge no longer needs theattention_output_gatefallback.Removed: none.
Validation
CW interactive, containerized:
uv run --no-sync python -m pytest tests/unit_tests/diffusion/model/common/test_dit_attention.py tests/unit_tests/models/stepfun/test_step35_bridge.py -q->67 passed, 35 warningsUV_NO_SYNC=1 uv run pre-commit run --all-files-> passed all hooksLocal focused static checks:
.venv/bin/python -m py_compile <edited files>-> passed.venv/bin/ruff check <edited files>-> passed