Skip to content

Commit 617868e

Browse files
committed
run make fix-copies and make style
1 parent 705c592 commit 617868e

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,13 @@ def pack_weights(layers, prefix):
15911591
layers_state_dict = {f"{prefix}.{module_name}": param for module_name, param in layers_weights.items()}
15921592
return layers_state_dict
15931593

1594-
state_dict.update(pack_weights(unet_lora_layers, "unet"))
1594+
if not (unet_lora_layers or text_encoder_lora_layers or text_encoder_2_lora_layers):
1595+
raise ValueError(
1596+
"You must pass at least one of `unet_lora_layers`, `text_encoder_lora_layers` or `text_encoder_2_lora_layers`."
1597+
)
1598+
1599+
if unet_lora_layers:
1600+
state_dict.update(pack_weights(unet_lora_layers, "unet"))
15951601

15961602
if text_encoder_lora_layers and text_encoder_2_lora_layers:
15971603
state_dict.update(pack_weights(text_encoder_lora_layers, "text_encoder"))

src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,13 @@ def pack_weights(layers, prefix):
12541254
layers_state_dict = {f"{prefix}.{module_name}": param for module_name, param in layers_weights.items()}
12551255
return layers_state_dict
12561256

1257-
state_dict.update(pack_weights(unet_lora_layers, "unet"))
1257+
if not (unet_lora_layers or text_encoder_lora_layers or text_encoder_2_lora_layers):
1258+
raise ValueError(
1259+
"You must pass at least one of `unet_lora_layers`, `text_encoder_lora_layers` or `text_encoder_2_lora_layers`."
1260+
)
1261+
1262+
if unet_lora_layers:
1263+
state_dict.update(pack_weights(unet_lora_layers, "unet"))
12581264

12591265
if text_encoder_lora_layers and text_encoder_2_lora_layers:
12601266
state_dict.update(pack_weights(text_encoder_lora_layers, "text_encoder"))

src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,13 @@ def pack_weights(layers, prefix):
953953
layers_state_dict = {f"{prefix}.{module_name}": param for module_name, param in layers_weights.items()}
954954
return layers_state_dict
955955

956-
state_dict.update(pack_weights(unet_lora_layers, "unet"))
956+
if not (unet_lora_layers or text_encoder_lora_layers or text_encoder_2_lora_layers):
957+
raise ValueError(
958+
"You must pass at least one of `unet_lora_layers`, `text_encoder_lora_layers` or `text_encoder_2_lora_layers`."
959+
)
960+
961+
if unet_lora_layers:
962+
state_dict.update(pack_weights(unet_lora_layers, "unet"))
957963

958964
if text_encoder_lora_layers and text_encoder_2_lora_layers:
959965
state_dict.update(pack_weights(text_encoder_lora_layers, "text_encoder"))

src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,13 @@ def pack_weights(layers, prefix):
11121112
layers_state_dict = {f"{prefix}.{module_name}": param for module_name, param in layers_weights.items()}
11131113
return layers_state_dict
11141114

1115-
state_dict.update(pack_weights(unet_lora_layers, "unet"))
1115+
if not (unet_lora_layers or text_encoder_lora_layers or text_encoder_2_lora_layers):
1116+
raise ValueError(
1117+
"You must pass at least one of `unet_lora_layers`, `text_encoder_lora_layers` or `text_encoder_2_lora_layers`."
1118+
)
1119+
1120+
if unet_lora_layers:
1121+
state_dict.update(pack_weights(unet_lora_layers, "unet"))
11161122

11171123
if text_encoder_lora_layers and text_encoder_2_lora_layers:
11181124
state_dict.update(pack_weights(text_encoder_lora_layers, "text_encoder"))

src/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_inpaint.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,13 @@ def pack_weights(layers, prefix):
14261426
layers_state_dict = {f"{prefix}.{module_name}": param for module_name, param in layers_weights.items()}
14271427
return layers_state_dict
14281428

1429-
state_dict.update(pack_weights(unet_lora_layers, "unet"))
1429+
if not (unet_lora_layers or text_encoder_lora_layers or text_encoder_2_lora_layers):
1430+
raise ValueError(
1431+
"You must pass at least one of `unet_lora_layers`, `text_encoder_lora_layers` or `text_encoder_2_lora_layers`."
1432+
)
1433+
1434+
if unet_lora_layers:
1435+
state_dict.update(pack_weights(unet_lora_layers, "unet"))
14301436

14311437
if text_encoder_lora_layers and text_encoder_2_lora_layers:
14321438
state_dict.update(pack_weights(text_encoder_lora_layers, "text_encoder"))

0 commit comments

Comments
 (0)