Skip to content

Commit b0a6534

Browse files
committed
controlnet_keep
1 parent 521fe42 commit b0a6534

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/diffusers/pipelines/controlnet/pipeline_controlnet_union_inpaint_sd_xl.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,11 +1595,10 @@ def denoising_value_valid(dnv):
15951595
# 8.2 Create tensor stating which controlnets to keep
15961596
controlnet_keep = []
15971597
for i in range(len(timesteps)):
1598-
keeps = [
1599-
1.0 - float(i / len(timesteps) < s or (i + 1) / len(timesteps) > e)
1600-
for s, e in zip(control_guidance_start, control_guidance_end)
1601-
]
1602-
controlnet_keep.append(keeps[0])
1598+
controlnet_keep.append(
1599+
1.0
1600+
- float(i / len(timesteps) < control_guidance_start or (i + 1) / len(timesteps) > control_guidance_end)
1601+
)
16031602

16041603
# 9. Prepare extra step kwargs. TODO: Logic should ideally just be moved out of the pipeline
16051604
height, width = latents.shape[-2:]

src/diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,12 +1333,9 @@ def __call__(
13331333
# 7.1 Create tensor stating which controlnets to keep
13341334
controlnet_keep = []
13351335
for i in range(len(timesteps)):
1336-
keeps = [
1337-
1.0 - float(i / len(timesteps) < s or (i + 1) / len(timesteps) > e)
1338-
for s, e in zip(control_guidance_start, control_guidance_end)
1339-
]
13401336
controlnet_keep.append(
1341-
keeps[0] if isinstance(controlnet, (ControlNetModel, ControlNetUnionModel)) else keeps
1337+
1.0
1338+
- float(i / len(timesteps) < control_guidance_start or (i + 1) / len(timesteps) > control_guidance_end)
13421339
)
13431340

13441341
# 7.2 Prepare added time ids & embeddings

src/diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl_img2img.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,12 +1416,9 @@ def __call__(
14161416
# 7.1 Create tensor stating which controlnets to keep
14171417
controlnet_keep = []
14181418
for i in range(len(timesteps)):
1419-
keeps = [
1420-
1.0 - float(i / len(timesteps) < s or (i + 1) / len(timesteps) > e)
1421-
for s, e in zip(control_guidance_start, control_guidance_end)
1422-
]
14231419
controlnet_keep.append(
1424-
keeps[0] if isinstance(controlnet, (ControlNetModel, ControlNetUnionModel)) else keeps
1420+
1.0
1421+
- float(i / len(timesteps) < control_guidance_start or (i + 1) / len(timesteps) > control_guidance_end)
14251422
)
14261423

14271424
# 7.2 Prepare added time ids & embeddings

0 commit comments

Comments
 (0)