Skip to content

Commit 1896b1f

Browse files
authored
lora_bias PEFT version check in unet.load_attn_procs (#10474)
`lora_bias` PEFT version check in `unet.load_attn_procs` path
1 parent b572635 commit 1896b1f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/diffusers/loaders/unet.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,17 @@ def _process_lora(
343343
else:
344344
if is_peft_version("<", "0.9.0"):
345345
lora_config_kwargs.pop("use_dora")
346+
347+
if "lora_bias" in lora_config_kwargs:
348+
if lora_config_kwargs["lora_bias"]:
349+
if is_peft_version("<=", "0.13.2"):
350+
raise ValueError(
351+
"You need `peft` 0.14.0 at least to use `bias` in LoRAs. Please upgrade your installation of `peft`."
352+
)
353+
else:
354+
if is_peft_version("<=", "0.13.2"):
355+
lora_config_kwargs.pop("lora_bias")
356+
346357
lora_config = LoraConfig(**lora_config_kwargs)
347358

348359
# adapter_name

0 commit comments

Comments
 (0)