Fix KeyError for non-attention LoRA sublayers in Flux/Chroma mixture-format converter#14010
Draft
dxqb wants to merge 1 commit into
Draft
Fix KeyError for non-attention LoRA sublayers in Flux/Chroma mixture-format converter#14010dxqb wants to merge 1 commit into
dxqb wants to merge 1 commit into
Conversation
…format converter _convert_kohya_flux_lora_to_diffusers's mixture-format branch only mapped attention sublayers (to_q/to_k/to_v/to_out/add_*) to their real submodule path; any other block sublayer (norm1.linear, ff.net.*, proj_mlp, ...) fell through to the bare block path (e.g. "transformer_blocks.0"), which is a container module, not a leaf parameter, causing a KeyError later in _maybe_expand_lora_state_dict. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
tested, but needs an end-to-end test |
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.
What does this PR do?
Fixes the
KeyErrordescribed in #14009 —_convert_kohya_flux_lora_to_diffusers's mixture-format branch only mapped attention sublayers of a transformer block to their real submodule path; every other sublayer (norm1.linear,ff.net.*,proj_mlp, ...) fell through to the bare block path, which is a container module, not a leaf parameter. See #14009 for the full repro and root cause.This adds explicit mapping for the remaining block sublayers (mirroring the equivalent target names already used elsewhere in this file, e.g.
TRANSFORMER_KEYS_RENAME_DICT), and raisesNotImplementedErrorfor any genuinely unhandled key instead of silently falling back to the bare block path.Fixes #14009
Who can review?
@sayakpaul @yiyixuxu
Drafted by Claude