Repository: huggingface/diffusers
Pull request: auto type conversion
Default value of `control_guidance_start` and `control_guidance_end` in `StableDiffusionControlNetPipeline.check_inputs` function causes `TypeError: object of type 'float' has no len()`

Proposed fix: 
Convert `control_guidance_start` and `control_guidance_end` to type list if float

# What does this PR do?

Fixes #4269

@holwech 


Problem statement:
Default args in `StableDiffusionControlNetPipeline.check_inputs` causes TypeError
### Describe the bug

Default value of `control_guidance_start` and `control_guidance_end` in `StableDiffusionControlNetPipeline.check_inputs` function causes `TypeError: object of type 'float' has no len()`

### Reproduction

```
from diffusers import (
   StableDiffusionControlNetPipeline,
   ControlNetModel
)
import torch
from PIL import Image

controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
pipe = StableDiffusionControlNetPipeline.from_pretrained('runwayml/stable-diffusion-v1-5', controlnet=controlnet)

pipe.check_inputs('', Image.new('RGB',(512,512)), callback_steps=1)

```

### Logs

```shell
`text_config_dict` is provided which will be used to initialize `CLIPTextConfig`. The value `text_config["id2label"]` will be overriden.
Traceback (most recent call last):
  File "bug.py", line 11, in <module>
    pipe.check_inputs('',Image.new('L',(512,512)),callback_steps=1)
  File "/home/neil/anaconda3/envs/reference_only/lib/python3.8/site-packages/diffusers/pipelines/controlnet/pipeline_controlnet.py", line 598, in check_inputs
    if len(control_guidance_start) != len(control_guidance_end):
TypeError: object of type 'float' has no len()
```


### System Info

- `diffusers` version: 0.18.2
- Platform: Linux-5.15.0-1037-gcp-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyTorch version (GPU?): 2.0.1+cu117 (True)
- Huggingface_hub version: 0.16.4
- Transformers version: 4.30.2
- Accelerate version: 0.18.0
- xFormers version: 0.0.17
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

### Who can help?

@patrickvonplaten

Hints from issue discussion:
Does this error only happen when manually calling `check_inputs` or also generally when the pipeline is called?
I see this error when running the community `stable_diffusion_controlnet_reference` pipeline. It might be the only pipeline that calls `StableDiffusionControlNetPipeline.check_inputs` based on my quick search.
```
from diffusers import (
    DiffusionPipeline,
    ControlNetModel,
)
from diffusers.utils import load_image
import torch

controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)

pipe = DiffusionPipeline.from_pretrained(
       "runwayml/stable-diffusion-v1-5",
       safety_checker=None,
       torch_dtype=torch.float16,
       controlnet=controlnet,
       custom_pipeline="stable_diffusion_controlnet_reference",
       ).to('cuda')

input_image = load_image("https://hf.co/datasets/huggingface/documentation-images/resolve/main/diffusers/input_image_vermeer.png")

results = pipe(
    ref_image=input_image,
    prompt="1girl",
    num_inference_steps=20,
    reference_attn=True,
    reference_adain=True,
    image=input_image
).images
```

Commit message: Update src/diffusers/pipelines/controlnet/pipeline_controlnet.py

Patch to review:
diff --git a/src/diffusers/pipelines/controlnet/pipeline_controlnet.py b/src/diffusers/pipelines/controlnet/pipeline_controlnet.py
index 42d2d14c44c5..f86916b77ae8 100644
--- a/src/diffusers/pipelines/controlnet/pipeline_controlnet.py
+++ b/src/diffusers/pipelines/controlnet/pipeline_controlnet.py
@@ -554,6 +554,12 @@ def check_inputs(
         else:
             assert False
 
+        if isinstance(control_guidance_start, float):
+            control_guidance_start = [control_guidance_start]
+            
+        if isinstance(control_guidance_end, float):
+            control_guidance_end = [control_guidance_end]
+            
         if len(control_guidance_start) != len(control_guidance_end):
             raise ValueError(
                 f"`control_guidance_start` has {len(control_guidance_start)} elements, but `control_guidance_end` has {len(control_guidance_end)} elements. Make sure to provide the same number of elements to each list."


Code review comments:
diff_hunk: @@ -554,6 +554,12 @@ def check_inputs(
         else:
             assert False
 
+        if isinstance(control_guidance_start, float):
+            control_guidance_start = [control_guidance_start]
+            
+        if isinstance(control_guidance_end, float):
path: src/diffusers/pipelines/controlnet/pipeline_controlnet.py
text: @user1:
```suggestion
        if not isinstance(control_guidance_end, (tuple, list)):
```

diff_hunk: @@ -554,6 +554,12 @@ def check_inputs(
         else:
             assert False
 
+        if isinstance(control_guidance_start, float):
path: src/diffusers/pipelines/controlnet/pipeline_controlnet.py
text: @user1:
```suggestion
        if not isinstance(control_guidance_start, (tuple, list)):
```