mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-08-15 01:26:42 +00:00
Fixed an issue where qwenLora could not be loaded properly. (#9208)
This commit is contained in:
parent
9126c0cfe4
commit
4c3e57b0ae
@ -293,6 +293,15 @@ def model_lora_keys_unet(model, key_map={}):
|
|||||||
key_lora = k[len("diffusion_model."):-len(".weight")]
|
key_lora = k[len("diffusion_model."):-len(".weight")]
|
||||||
key_map["{}".format(key_lora)] = k
|
key_map["{}".format(key_lora)] = k
|
||||||
|
|
||||||
|
if isinstance(model, comfy.model_base.QwenImage):
|
||||||
|
for k in sdk:
|
||||||
|
if k.startswith("diffusion_model.") and k.endswith(".weight"): #QwenImage lora format
|
||||||
|
key_lora = k[len("diffusion_model."):-len(".weight")]
|
||||||
|
# Direct mapping for transformer_blocks format (QwenImage LoRA format)
|
||||||
|
key_map["{}".format(key_lora)] = k
|
||||||
|
# Support transformer prefix format
|
||||||
|
key_map["transformer.{}".format(key_lora)] = k
|
||||||
|
|
||||||
return key_map
|
return key_map
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ class LoRAAdapter(WeightAdapterBase):
|
|||||||
diffusers3_lora = "{}.lora.up.weight".format(x)
|
diffusers3_lora = "{}.lora.up.weight".format(x)
|
||||||
mochi_lora = "{}.lora_B".format(x)
|
mochi_lora = "{}.lora_B".format(x)
|
||||||
transformers_lora = "{}.lora_linear_layer.up.weight".format(x)
|
transformers_lora = "{}.lora_linear_layer.up.weight".format(x)
|
||||||
|
qwen_default_lora = "{}.lora_B.default.weight".format(x)
|
||||||
A_name = None
|
A_name = None
|
||||||
|
|
||||||
if regular_lora in lora.keys():
|
if regular_lora in lora.keys():
|
||||||
@ -122,6 +123,10 @@ class LoRAAdapter(WeightAdapterBase):
|
|||||||
A_name = transformers_lora
|
A_name = transformers_lora
|
||||||
B_name = "{}.lora_linear_layer.down.weight".format(x)
|
B_name = "{}.lora_linear_layer.down.weight".format(x)
|
||||||
mid_name = None
|
mid_name = None
|
||||||
|
elif qwen_default_lora in lora.keys():
|
||||||
|
A_name = qwen_default_lora
|
||||||
|
B_name = "{}.lora_A.default.weight".format(x)
|
||||||
|
mid_name = None
|
||||||
|
|
||||||
if A_name is not None:
|
if A_name is not None:
|
||||||
mid = None
|
mid = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user