{"record":{"id":"7e7334f880912246","repo":"invoke-ai/InvokeAI","slug":"lora-lora-lora-key-has-conflicting-weights-on","errorCode":null,"errorMessage":"LoRA '{lora.lora.key}' has conflicting weights on the transformer ({transformer_lora.weight}) and Qwen3-VL encoder ({encoder_lora.weight}).","messagePattern":"LoRA '(.+?)' has conflicting weights on the transformer \\((.+?)\\) and Qwen3-VL encoder \\((.+?)\\)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/krea2_lora_loader.py","lineNumber":172,"sourceCode":"                    \"not Krea-2 models. Ensure you are using a Krea-2 compatible LoRA.\"\n                )\n\n            transformer_lora = (\n                next((item for item in output.transformer.loras if item.lora.key == lora.lora.key), None)\n                if output.transformer is not None\n                else None\n            )\n            encoder_lora = (\n                next((item for item in output.qwen3_vl_encoder.loras if item.lora.key == lora.lora.key), None)\n                if output.qwen3_vl_encoder is not None\n                else None\n            )\n            if (\n                transformer_lora is not None\n                and encoder_lora is not None\n                and transformer_lora.weight != encoder_lora.weight\n            ):\n                raise ValueError(\n                    f\"LoRA '{lora.lora.key}' has conflicting weights on the transformer \"\n                    f\"({transformer_lora.weight}) and Qwen3-VL encoder ({encoder_lora.weight}).\"\n                )\n            effective_lora = transformer_lora or encoder_lora or lora\n\n            if self.transformer is not None and output.transformer is not None:\n                if transformer_lora is None:\n                    output.transformer.loras.append(effective_lora.model_copy(deep=True))\n            if self.qwen3_vl_encoder is not None and output.qwen3_vl_encoder is not None:\n                if encoder_lora is None:\n                    output.qwen3_vl_encoder.loras.append(effective_lora.model_copy(deep=True))\n\n        return output\n","sourceCodeStart":154,"sourceCodeEnd":186,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/krea2_lora_loader.py#L154-L186","documentation":"The Krea-2 LoRA loader allows a single LoRA to be applied to both the transformer and the Qwen3-VL text encoder, but only when both applications use the same weight. If a LoRA entry resolves to weights on both components with different values, InvokeAI cannot pick one unambiguously and raises this ValueError during invoke().","triggerScenarios":"Calling Krea2LoRALoaderInput invoke() with a LoRA list containing a LoRA whose model has both a transformer-side and Qwen3-VL-encoder-side state dict (or is applied to both), while the resolved transformer_lora.weight differs from encoder_lora.weight (e.g. weight 0.8 on transformer, 0.5 on encoder).","commonSituations":"Users setting different strength values for the same LoRA on transformer vs encoder via UI/API fields; multi-LoRA workflows where one entry supports both submodels; migrating prompts from other tools where encoder strength was scaled independently.","solutions":["Set the LoRA's transformer weight and Qwen3-VL encoder weight to the same value for that entry.","If only one target is wanted, load the LoRA so it only applies to the transformer (or encoder), not both.","Duplicate the LoRA entry in the list: one targeting only the transformer, one targeting only the encoder, each with its own weight.","Downgrade/verify the LoRA file — some checkpoints embed mismatched per-component metadata; re-export or patch it."],"exampleFix":"// before\nKrea2LoRALoader(lora=[LoRA(model=lora_model, weight=0.8)], transformer_weight=0.8, encoder_weight=0.5)\n// after\nKrea2LoRALoader(lora=[LoRA(model=lora_model, weight=0.8)], transformer_weight=0.8, encoder_weight=0.8)","handlingStrategy":"validation","validationCode":"from invokeai.app.invocations.krea2_lora_loader import Krea2LoRALoaderInput\n\nfor lora in lora_loader_input.lora:\n    t_w, e_w = lora.transformer_weight, lora.encoder_weight\n    if t_w is not None and e_w is not None and t_w != e_w:\n        raise ValueError(f\"LoRA {lora.model.key}: align transformer ({t_w}) and encoder ({e_w}) weights\")","typeGuard":"def weights_aligned(t_w: float | None, e_w: float | None) -> bool:\n    return t_w is None or e_w is None or t_w == e_w","tryCatchPattern":"try:\n    output = lora_loader.invoke(context)\nexcept ValueError as e:\n    if \"conflicting weights\" in str(e):\n        logger.warning(str(e)); output = fallback_with_uniform_weights(context)\n    else:\n        raise","preventionTips":["Always set encoder weight equal to transformer weight unless the LoRA targets only one component","Check LoRA model metadata for per-component defaults before loading","Add a pre-invoke validation step in pipelines that accept user-supplied LoRA strengths"],"tags":["lora","invokeai","model-loading","configuration"],"backgroundTag":"lora-weight-conflict","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}