Skip to content

Fix KeyError for non-attention LoRA sublayers in Flux/Chroma mixture-format converter#14010

Draft
dxqb wants to merge 1 commit into
huggingface:mainfrom
dxqb:fix-mixture-lora-non-attn-keys
Draft

Fix KeyError for non-attention LoRA sublayers in Flux/Chroma mixture-format converter#14010
dxqb wants to merge 1 commit into
huggingface:mainfrom
dxqb:fix-mixture-lora-non-attn-keys

Conversation

@dxqb

@dxqb dxqb commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the KeyError described 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 raises NotImplementedError for any genuinely unhandled key instead of silently falling back to the bare block path.

Fixes #14009

Who can review?

@sayakpaul @yiyixuxu


Drafted by Claude

…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>
@dxqb

dxqb commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

tested, but needs an end-to-end test
will mark it "Ready for review" after the test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes-issue lora size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kohya->diffusers LoRA key converter fails for Chroma and Flux1, if LoRA is not attention-only

1 participant