Optimize 2D tensor gathering to skip sensitive layers early#17
Open
gacty wants to merge 1 commit intosilveroxides:mainfrom
Open
Optimize 2D tensor gathering to skip sensitive layers early#17gacty wants to merge 1 commit intosilveroxides:mainfrom
gacty wants to merge 1 commit intosilveroxides:mainfrom
Conversation
Uses existing AVOID_KEY_NAMES to skip sensitive layers before loading into weight_keys
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
Adds early filtering for normalization/modulation layers at the 2D tensor gathering stage (line 261)
Problem
Currently, sensitive layers (norms, modulations, embeddings) are gathered into
weight_keysand then filtered out later in the exclusion logic (around line 324+). This means they're loaded into memory unnecessarilySolution
Move common exclusion patterns up to the gathering stage using the existing
AVOID_KEY_NAMESconstant:This acts as a "first line of defense" before the MODEL_FILTERS logic
Benefits
Reduces the memory footprint of
weight_keyslistWill avoid unnecessary downstream filtering for already-excluded layers
Complements an existing MODEL_FILTERS system
No behavioral changes