[Issue]: SD1.5 - Control - Error when attempting to use multiple units
Issue Description
23_1_4_controlNext multiple unit error log.txt
When attempting to use multiple controlnets, the second controlnet unit is ignored. When I attempt to reset/reload via clicking the enable checkbox for both units, I get the below error (also see more complete log attached).
The error occurs for both classic Controlnet and T2I-Adapter
Version Platform Description
Version app: SD.next updated: 2023-12-30 hash: ab7b78cc url: https://github.com/vladmandic/automatic/tree/master
Platform arch: AMD64 cpu: Intel64 Family 6 Model 151 Stepping 2, GenuineIntel system: Windows release: Windows-10-10.0.19045-SP0 python: 3.11.5
GPU device: NVIDIA GeForce RTX 3080 (1) (sm_90) (8, 6) cuda: 12.1 cudnn: 8801 driver: 546.01
Browser: Mozilla Firefox
Relevant log output
13:15:16-552459 ERROR Control pipeline failed: type=controlnet units=2 error=OpenCV(4.8.1)
D:\a\opencv-python\opencv-python\opencv\modules\core\src\arithm.cpp:650: error: (-209:Sizes of
input arguments do not match) The operation is neither 'array op array' (where arrays have the
same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in
function 'cv::arithm_op'
13:15:16-563458 ERROR Control: error
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ C:\Users\machi\automatic\modules\control\run.py:384 in control_run │
│ │
│ 383 │ │ │ │ │ │ processed_image = [np.array(i) for i in p.image] │
│ > 384 │ │ │ │ │ │ processed_image = util.blend(processed_image) # blend all proces │
│ 385 │ │ │ │ │ │ processed_image = Image.fromarray(processed_image) │
│ │
│ C:\Users\machi\automatic\modules\control\util.py:152 in blend │
│ │
│ 151 │ for img in images: │
│ > 152 │ │ y = cv2.add(y, img.astype(np.float32)) │
│ 153 │ y = y.clip(0, 255).astype(np.uint8) │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\core\src\arithm.cpp:650: error: (-209:Sizes of
input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same
number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'
Traceback (most recent call last):
File "C:\Users\machi\automatic\venv\Lib\site-packages\gradio\queueing.py", line 388, in call_prediction
output = await route_utils.call_process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\machi\automatic\venv\Lib\site-packages\gradio\route_utils.py", line 219, in call_process_api
output = await app.get_blocks().process_api(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\machi\automatic\venv\Lib\site-packages\gradio\blocks.py", line 1440, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\machi\automatic\venv\Lib\site-packages\gradio\blocks.py", line 1341, in postprocess_data
prediction_value = block.postprocess(prediction_value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\machi\automatic\venv\Lib\site-packages\gradio\components\image.py", line 320, in postprocess
raise ValueError("Cannot process this value as an Image")
ValueError: Cannot process this value as an Image
Backend
Diffusers
Branch
Master
Model
SD 1.5
Acknowledgements
- [X] I have read the above and searched for existing issues
- [X] I confirm that this is classified correctly and its not an extension issue
issue seems to happen because multiple preprocessors returned processed images of different sizes. what was the size of input image and which processors did you use for both units?
Input size was 512x768. I was originally downscaling from 2049x2073 (before), but I manually downscaled to 512x768 (which was the target image size). There was only a single image, so both processors were using the same image.
For unit 1: Midas hybrid depth processor, Depth model/Depthv2 adapter For unit 2: Canny processor, Canny model/Cannyv2 adapter
EDIT: Reproduced it using different combo of units as well (Unit 1: Canny, Unit 2: Shuffle) EDIT2: Also reproduced it using the "After" resize order as opposed to the "Before" resize order.
I was just checking if this has been reported. I have the same issue. Version: app=sd.next updated=2023-12-30 hash=ab7b78cc Diffusers backend
Using ControlNet Unit 1 Canny and Unit 2 Depth. Tested with Image Size 723x1179 and 512x512. Getting the exact same error.
This also happens with T2I-Adapter with more than 1 unit. I haven't tested others yet. EDIT: Also using only one image as source
fixed in dev, will be merged to master in the next release (soon)