Skip to content

Commit

Permalink
updating weight names to match original instead of comfyui (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacepxl authored Feb 10, 2025
1 parent 8b1c529 commit 916602b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/hunyuan_video/convert_diffusers_lora_to_original.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

def convert_lora_sd(diffusers_lora_sd):
double_block_patterns = {
"attn.to_out.0": "img_attn.proj",
"attn.to_out.0": "img_attn_proj",
"ff.net.0.proj": "img_mlp.0",
"ff.net.2": "img_mlp.2",
"attn.to_add_out": "txt_attn.proj",
"attn.to_add_out": "txt_attn_proj",
"ff_context.net.0.proj": "txt_mlp.0",
"ff_context.net.2": "txt_mlp.2",
}
Expand All @@ -30,7 +30,7 @@ def convert_lora_sd(diffusers_lora_sd):

to_qkv_A = torch.cat([to_q_A, to_k_A, to_v_A], dim=0)
qkv_A_key = key.replace("transformer_blocks", prefix + "double_blocks").replace(
"attn.to_q", "img_attn.qkv"
"attn.to_q", "img_attn_qkv"
)
converted_lora_sd[qkv_A_key] = to_qkv_A

Expand All @@ -52,7 +52,7 @@ def convert_lora_sd(diffusers_lora_sd):

to_qkv_A = torch.cat([to_q_A, to_k_A, to_v_A], dim=0)
qkv_A_key = key.replace("transformer_blocks", prefix + "double_blocks").replace(
"attn.add_q_proj", "txt_attn.qkv"
"attn.add_q_proj", "txt_attn_qkv"
)
converted_lora_sd[qkv_A_key] = to_qkv_A

Expand Down

0 comments on commit 916602b

Please sign in to comment.