[LoRA] accept fal Kontext LoRAs whose embedder keys lack the base_model.model. prefix - #14918
christopher5106 wants to merge 3 commits into
Conversation
…ase_model.model. prefix Some fal-kontext LoRAs store time_in / vector_in / txt_in / img_in / guidance_in without the `base_model.model.` prefix the block keys use, so `_convert_fal_kontext_lora_to_diffusers` left them in `original_state_dict` and raised "`original_state_dict` should be empty at this point". Map them to their diffusers names before that check. Rebuilt from 02abf7eb1 (2026-04-15) without its Kohya Flux.2 hunks, which upstream now covers with `_convert_kohya_flux2_lora_to_diffusers`.
diffusers does not unit-test private converter functions against third-party checkpoint layouts; the fix is reproducible through FluxPipeline.lora_state_dict (see the linked issue).
sayakpaul
left a comment
There was a problem hiding this comment.
Thanks! Do you have an example LoRA checkpoint?
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
I was not able to find out how users got this lora. The unprefixed embedder names do exist in one place: Black Forest Labs' official Control LoRAs. Those use that naming on every key, with no prefix anywhere. So our users' file mixes two formats. That points to a merged or hand-converted file rather than a trainer's direct output, but nothing confirms it. │ Source │ Result │ |
|
Then how did you come up with this PR if you don't have a real checkpoint? |
What does this PR do?
Fixes #14917
Some fal FLUX.1 Kontext LoRAs store the block keys under
base_model.model.but the global embedder keys (time_in,vector_in,txt_in,img_in,guidance_in) without that prefix._convert_fal_kontext_lora_to_diffusersdoes not map those keys, so they are left inoriginal_state_dictand loading fails with "original_state_dictshould be empty at this point".This PR maps the unprefixed embedder keys to their diffusers names (
time_text_embed.*_embedder.linear_{1,2},context_embedder,x_embedder) before that check. Files without these keys convert exactly as before.The reproduction in #14917 fails on
mainand converts all 1006 keys with this change.Before submitting
base_model.model.prefix either. I left that case out because I have not seen such a file.lora_A/lora_Bweights are mapped for the embedders, like the rest of this converter. No bias or alpha keys appear on these modules in the files I have seen.Who can review?
@sayakpaul @BenjaminBossan