1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

Fix: Use incorrect temporary variable key when replacing adapter name… (#12502)

Fix: Use incorrect temporary variable key when replacing adapter name in state dict within load_lora_adapter function

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
This commit is contained in:
Fei Xie
2025-10-21 09:45:37 +08:00
committed by GitHub
parent 48305755bf
commit decfa3c9e1

View File

@@ -293,7 +293,7 @@ class PeftAdapterMixin:
# For hotswapping, we need the adapter name to be present in the state dict keys
new_sd = {}
for k, v in sd.items():
if k.endswith("lora_A.weight") or key.endswith("lora_B.weight"):
if k.endswith("lora_A.weight") or k.endswith("lora_B.weight"):
k = k[: -len(".weight")] + f".{adapter_name}.weight"
elif k.endswith("lora_B.bias"): # lora_bias=True option
k = k[: -len(".bias")] + f".{adapter_name}.bias"