|
43 | 43 | AttnProcessor2_0, |
44 | 44 | XFormersAttnProcessor, |
45 | 45 | ) |
46 | | -from ...models.controlnets import ControlNetUnionInput, ControlNetUnionInputProMax |
47 | 46 | from ...models.lora import adjust_lora_scale_text_encoder |
48 | 47 | from ...schedulers import KarrasDiffusionSchedulers |
49 | 48 | from ...utils import ( |
@@ -786,26 +785,6 @@ def check_inputs( |
786 | 785 | f"`ip_adapter_image_embeds` has to be a list of 3D or 4D tensors but is {ip_adapter_image_embeds[0].ndim}D" |
787 | 786 | ) |
788 | 787 |
|
789 | | - def check_input( |
790 | | - self, |
791 | | - image: Union[ControlNetUnionInput, ControlNetUnionInputProMax], |
792 | | - ): |
793 | | - controlnet = self.controlnet._orig_mod if is_compiled_module(self.controlnet) else self.controlnet |
794 | | - |
795 | | - if not isinstance(image, (ControlNetUnionInput, ControlNetUnionInputProMax)): |
796 | | - raise ValueError( |
797 | | - "Expected type of `image` to be one of `ControlNetUnionInput` or `ControlNetUnionInputProMax`" |
798 | | - ) |
799 | | - if len(image) != controlnet.config.num_control_type: |
800 | | - if isinstance(image, ControlNetUnionInput): |
801 | | - raise ValueError( |
802 | | - f"Expected num_control_type {controlnet.config.num_control_type}, got {len(image)}. Try `ControlNetUnionInputProMax`." |
803 | | - ) |
804 | | - elif isinstance(image, ControlNetUnionInputProMax): |
805 | | - raise ValueError( |
806 | | - f"Expected num_control_type {controlnet.config.num_control_type}, got {len(image)}. Try `ControlNetUnionInput`." |
807 | | - ) |
808 | | - |
809 | 788 | # Copied from diffusers.pipelines.controlnet.pipeline_controlnet.StableDiffusionControlNetPipeline.prepare_image |
810 | 789 | def prepare_image( |
811 | 790 | self, |
@@ -1014,10 +993,7 @@ def __call__( |
1014 | 993 | prompt_2 (`str` or `List[str]`, *optional*): |
1015 | 994 | The prompt or prompts to be sent to `tokenizer_2` and `text_encoder_2`. If not defined, `prompt` is |
1016 | 995 | used in both text-encoders. |
1017 | | - image (`Union[ControlNetUnionInput, ControlNetUnionInputProMax]`): |
1018 | | - In turn this supports (`torch.FloatTensor`, `PIL.Image.Image`, `np.ndarray`, `List[torch.FloatTensor]`, |
1019 | | - `List[PIL.Image.Image]`, `List[np.ndarray]`, `List[List[torch.FloatTensor]]`, |
1020 | | - `List[List[np.ndarray]]` or `List[List[PIL.Image.Image]]`): |
| 996 | + control_image (`PipelineImageInput`): |
1021 | 997 | The ControlNet input condition to provide guidance to the `unet` for generation. If the type is |
1022 | 998 | specified as `torch.Tensor`, it is passed to ControlNet as is. `PIL.Image.Image` can also be accepted |
1023 | 999 | as an image. The dimensions of the output image defaults to `image`'s dimensions. If height and/or |
@@ -1164,8 +1140,6 @@ def __call__( |
1164 | 1140 |
|
1165 | 1141 | controlnet = self.controlnet._orig_mod if is_compiled_module(self.controlnet) else self.controlnet |
1166 | 1142 |
|
1167 | | - self.check_input(control_image) |
1168 | | - |
1169 | 1143 | # align format for control guidance |
1170 | 1144 | if not isinstance(control_guidance_start, list) and isinstance(control_guidance_end, list): |
1171 | 1145 | control_guidance_start = len(control_guidance_end) * [control_guidance_start] |
|
0 commit comments