SIGN IN SIGN UP

feat(lora): support PEFT named-adapter LoRAs (e.g. Klein 9B) (#9252)

PEFT-format LoRAs with a named adapter encode the adapter name in the
weight key (e.g. `foo.lora_A.default.weight` instead of `foo.lora_A.weight`).
InvokeAI's format detection and conversion only matched the standard PEFT
suffix, so these files were classified as Unknown and silently ignored.

Normalize named-adapter keys to the standard PEFT form in both
`ModelOnDisk.load_state_dict` (detection pipeline) and `LoRALoader._load_model`
(conversion pipeline). The pattern is LoRA-specific, so this is a no-op for
non-LoRA state dicts. State dicts with multiple distinct adapter names are
left untouched to avoid key collisions.

Also widen Flux2-Klein diffusers detection to accept keys without a
`transformer.` or `base_model.model.` prefix — some trainers (Modelscope /
MuseAI Klein 9B finetunes) save at the top level.

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
A
Alexander Eichhorn committed
75f199244de8cd0ff8012b6e196bc2fd4b6bbd82
Parent: 3247696
Committed by GitHub <noreply@github.com> on 6/5/2026, 1:58:51 AM