Skip to content

Commit c703294

Browse files
committed
made the comments a bit more explanatory
1 parent 1819689 commit c703294

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_controlnet.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ def __call__(
953953

954954
# controlnet(s) inference
955955
if guess_mode and do_classifier_free_guidance:
956-
# only use the cond batch for the controlnet
956+
# Infer ControlNet only for the conditional batch.
957957
controlnet_latent_model_input = latents
958958
controlnet_prompt_embeds = prompt_embeds.chunk(2)[1]
959959
else:
@@ -971,7 +971,9 @@ def __call__(
971971
)
972972

973973
if guess_mode and do_classifier_free_guidance:
974-
# fill zero to uncond batch
974+
# Infered ControlNet only for the conditional batch.
975+
# To apply the output of ControlNet to both the unconditional and conditional batches,
976+
# add 0 to the unconditional batch to keep it unchanged.
975977
down_block_res_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_block_res_samples]
976978
mid_block_res_sample = torch.cat([torch.zeros_like(mid_block_res_sample), mid_block_res_sample])
977979

0 commit comments

Comments
 (0)