Skip to content

Commit e4e1bff

Browse files
Support diffusion-pipe hunyuan video lora format.
1 parent d6656b0 commit e4e1bff

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

comfy/lora.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,17 @@ def model_lora_keys_unet(model, key_map={}):
374374
key_lora = k[len("diffusion_model."):-len(".weight")]
375375
key_map["{}".format(key_lora)] = k
376376

377+
if isinstance(model, comfy.model_base.HunyuanVideo):
378+
for k in sdk:
379+
if k.startswith("diffusion_model.") and k.endswith(".weight"):
380+
# diffusion-pipe lora format
381+
key_lora = k
382+
key_lora = key_lora.replace("_mod.lin.", "_mod.linear.").replace("_attn.qkv.", "_attn_qkv.").replace("_attn.proj.", "_attn_proj.")
383+
key_lora = key_lora.replace("mlp.0.", "mlp.fc1.").replace("mlp.2.", "mlp.fc2.")
384+
key_lora = key_lora.replace(".modulation.lin.", ".modulation.linear.")
385+
key_lora = key_lora[len("diffusion_model."):-len(".weight")]
386+
key_map["transformer.{}".format(key_lora)] = k
387+
377388
return key_map
378389

379390

0 commit comments

Comments
 (0)