File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/diffusers/pipelines/stable_diffusion Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments