fix(flux): support .weight variant for attention norm parameter mappings#9190
Open
Fortyseven wants to merge 3 commits into
Open
fix(flux): support .weight variant for attention norm parameter mappings#9190Fortyseven wants to merge 3 commits into
Fortyseven wants to merge 3 commits into
Conversation
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
Some Flux model checkpoints use
*.weightinstead of*.scalefor attention normalization layer parameters (query_normandkey_norm). The model loader's key mapping functions only checked for.scale, causing these checkpoints to fail loading with unmapped keys.This change updates all affected mapping functions across multiple Flux model type handlers to also match the
.weightvariant, mapping it to the same internal parameter name as.scale.Related Issues / Discussions
https://discord.com/channels/1020123559063990373/1083864753543331981/1504216036168171570
QA Instructions
This was tested with Flux2-Klein-9B-True-V2. (Q4_K specifically, but other sizes exhibit the issue too.)
Installation goes fine, and it's recognized. However, attempting a generation results in:
After this patch: image generation works.
Note
It's important to note that while I have quite a long history in software development, I am on the very fringes of this particular tech. So I may be overlooking something in this 'fix' that's just outside my understanding. ;)