Skip to content

Commit c7618fc

Browse files
committed
lightx2v lora support from huggingface#12040
1 parent b655b80 commit c7618fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/diffusers/loaders/lora_conversion_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,10 @@ def _convert_non_diffusers_wan_lora_to_diffusers(state_dict):
19741974
converted_key = f"condition_embedder.image_embedder.{img_ours}.lora_B.weight"
19751975
if original_key in original_state_dict:
19761976
converted_state_dict[converted_key] = original_state_dict.pop(original_key)
1977+
bias_key_theirs = original_key.removesuffix(f".{lora_up_key}.weight") + ".diff_b"
1978+
if bias_key_theirs in original_state_dict:
1979+
bias_key = converted_key.removesuffix(".weight") + ".bias"
1980+
converted_state_dict[bias_key] = original_state_dict.pop(bias_key_theirs)
19771981

19781982
if len(original_state_dict) > 0:
19791983
diff = all(".diff" in k for k in original_state_dict)
@@ -2068,4 +2072,4 @@ def _convert_non_diffusers_ltxv_lora_to_diffusers(state_dict, non_diffusers_pref
20682072
raise ValueError("Invalid LoRA state dict for LTX-Video.")
20692073
converted_state_dict = {k.removeprefix(f"{non_diffusers_prefix}."): v for k, v in state_dict.items()}
20702074
converted_state_dict = {f"transformer.{k}": v for k, v in converted_state_dict.items()}
2071-
return converted_state_dict
2075+
return converted_state_dict

0 commit comments

Comments
 (0)