Add Hybrid Transformer block fusion#4463
Open
janEbert wants to merge 10 commits intoNVIDIA:mainfrom
Open
Conversation
Contributor
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Should yield the most forward- and backward-compatibility. Unfused checkpoints can be loaded into a fused model.
Do not modify `sharded_state_dict` method, instead use `generate_state_dict` to apply the transformation only when loading/saving.
626f895 to
b7e2b05
Compare
62292ad to
c5ca092
Compare
Phlip79
reviewed
Apr 28, 2026
Member
Phlip79
left a comment
There was a problem hiding this comment.
- Should we reject MTP usage within brackets?
- Can you add a working forward/backward test?
TestFusedLayerValidationjust has failure path coverage.
- Similarly disallowed as the pipe symbol. - More explicitly mentioned and handled.
3fefa13 to
ed1aeee
Compare
Contributor
Author
|
Great points! Addressed both. |
Phlip79
approved these changes
Apr 29, 2026
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.
Add fusion operator
[...]to--hybrid-layer-pattern, enabling packing subsequent sequence mixer + channel mixer operations into oneTransformerLayer. This way, we have better expectations of the operations and can leverage existing optimizations inTransformerLayer.For checkpointing, we save the model as if it was unfused, so that we have a canonical format and backward-compatibility. The model can be loaded in fused form from the unfused checkpoint. The transformations to the state dict are only applied when saving or loading.