Unverified Commit e49c04d5 authored by Lvkesheng Shen's avatar Lvkesheng Shen Committed by GitHub
Browse files

Bug fix for controlnetpipeline check_image (#7103)



* Bug fix for controlnetpipeline check_image

Bug fix for controlnetpipeline check_image when using multicontrolnet and prompt list

* Update test_inference_multiple_prompt_input function

* Update test_controlnet.py

add test for multiple prompts and multiple image conditioning

* Update test_controlnet.py

Fix format error

---------
Co-authored-by: default avatarLvkesheng Shen <45848260+Fantast416@users.noreply.github.com>
Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
parent f238cb07
...@@ -661,9 +661,9 @@ class StableDiffusionControlNetPipeline( ...@@ -661,9 +661,9 @@ class StableDiffusionControlNetPipeline(
raise ValueError( raise ValueError(
f"For multiple controlnets: `image` must have the same length as the number of controlnets, but got {len(image)} images and {len(self.controlnet.nets)} ControlNets." f"For multiple controlnets: `image` must have the same length as the number of controlnets, but got {len(image)} images and {len(self.controlnet.nets)} ControlNets."
) )
else:
for image_ in image: for image_ in image:
self.check_image(image_, prompt, prompt_embeds) self.check_image(image_, prompt, prompt_embeds)
else: else:
assert False assert False
......
...@@ -494,6 +494,15 @@ class StableDiffusionMultiControlNetPipelineFastTests( ...@@ -494,6 +494,15 @@ class StableDiffusionMultiControlNetPipelineFastTests(
assert np.abs(image - output_1.images).max() < 1e-3 assert np.abs(image - output_1.images).max() < 1e-3
# multiple prompts, multiple image conditioning
inputs = self.get_dummy_inputs(device)
inputs["prompt"] = [inputs["prompt"], inputs["prompt"], inputs["prompt"], inputs["prompt"]]
inputs["image"] = [inputs["image"], inputs["image"], inputs["image"], inputs["image"]]
output_2 = sd_pipe(**inputs)
image = output_2.images
assert image.shape == (4, 64, 64, 3)
class StableDiffusionMultiControlNetOneModelPipelineFastTests( class StableDiffusionMultiControlNetOneModelPipelineFastTests(
IPAdapterTesterMixin, PipelineTesterMixin, PipelineKarrasSchedulerTesterMixin, unittest.TestCase IPAdapterTesterMixin, PipelineTesterMixin, PipelineKarrasSchedulerTesterMixin, unittest.TestCase
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment