Unverified Commit decfa3c9 authored by Fei Xie's avatar Fei Xie Committed by GitHub
Browse files

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: default avatarSayak Paul <spsayakpaul@gmail.com>
parent 48305755
...@@ -293,7 +293,7 @@ class PeftAdapterMixin: ...@@ -293,7 +293,7 @@ class PeftAdapterMixin:
# For hotswapping, we need the adapter name to be present in the state dict keys # For hotswapping, we need the adapter name to be present in the state dict keys
new_sd = {} new_sd = {}
for k, v in sd.items(): 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" k = k[: -len(".weight")] + f".{adapter_name}.weight"
elif k.endswith("lora_B.bias"): # lora_bias=True option elif k.endswith("lora_B.bias"): # lora_bias=True option
k = k[: -len(".bias")] + f".{adapter_name}.bias" k = k[: -len(".bias")] + f".{adapter_name}.bias"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment