Skip to content

Commit 4d1e891

Browse files
committed
rename
1 parent dfad056 commit 4d1e891

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/diffusers/loaders/peft.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
MIN_PEFT_VERSION,
2727
USE_PEFT_BACKEND,
2828
check_peft_version,
29-
convert_control_lora_state_dict_to_peft,
29+
convert_sai_sd_control_lora_state_dict_to_peft,
3030
convert_unet_state_dict_to_peft,
3131
delete_adapter_layers,
3232
get_adapter_name,
@@ -233,9 +233,9 @@ def load_lora_adapter(
233233
# Control LoRA from SAI is different from BFL Control LoRA
234234
# https://huggingface.co/stabilityai/control-lora
235235
# https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors
236-
is_control_lora = "lora_controlnet" in state_dict
237-
if is_control_lora:
238-
state_dict = convert_control_lora_state_dict_to_peft(state_dict)
236+
is_sai_sd_control_lora = "lora_controlnet" in state_dict
237+
if is_sai_sd_control_lora:
238+
state_dict = convert_sai_sd_control_lora_state_dict_to_peft(state_dict)
239239

240240
rank = {}
241241
for key, val in state_dict.items():
@@ -269,7 +269,7 @@ def load_lora_adapter(
269269
)
270270

271271
# Adjust LoRA config for Control LoRA
272-
if is_control_lora:
272+
if is_sai_sd_control_lora:
273273
lora_config.lora_alpha = lora_config.r
274274
lora_config.alpha_pattern = lora_config.rank_pattern
275275
lora_config.bias = "all"

src/diffusers/utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
from .remote_utils import remote_decode
144144
from .state_dict_utils import (
145145
convert_all_state_dict_to_peft,
146-
convert_control_lora_state_dict_to_peft,
146+
convert_sai_sd_control_lora_state_dict_to_peft,
147147
convert_state_dict_to_diffusers,
148148
convert_state_dict_to_kohya,
149149
convert_state_dict_to_peft,

src/diffusers/utils/state_dict_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def convert_unet_state_dict_to_peft(state_dict):
289289
return convert_state_dict(state_dict, mapping)
290290

291291

292-
def convert_control_lora_state_dict_to_peft(state_dict):
292+
def convert_sai_sd_control_lora_state_dict_to_peft(state_dict):
293293
def _convert_controlnet_to_diffusers(state_dict):
294294
is_sdxl = "input_blocks.11.0.in_layers.0.weight" not in state_dict
295295
logger.info(f"Using ControlNet lora ({'SDXL' if is_sdxl else 'SD15'})")

0 commit comments

Comments
 (0)