Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: The truth value of an array with more than one element is ambiguous - Promax Inpainting #73

Open
muzammildafedar opened this issue Oct 26, 2024 · 1 comment

Comments

@muzammildafedar
Copy link

muzammildafedar commented Oct 26, 2024

Description:
I am encountering a RuntimeValueError when trying to generate images using the provided code snippet with the ControlNet pipeline. The error occurs specifically in the pipe function call. Below are the details of the error and the relevant code.

Code Sample:

# Generating images
images = pipe(
    prompt=[prompt],
    image=original_img,
    mask_image=mask,
    control_image_list=[controlnet_img_pose, 0, 0, controlnet_img_canny, 0, 0, 0, controlnet_img], 
    negative_prompt=[negative_prompt],
    width=W, 
    height=H,
    num_inference_steps=30,
    union_control=True,
    union_control_type=torch.Tensor([1, 0, 0, 1, 0, 0, 0, 1]),
).images

Error Message:

Traceback (most recent call last):
  File "/content/ControlNetPlus/controlnet_union_test_inpainting.py", line 74, in <module>
    images = pipe(
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/content/ControlNetPlus/pipeline/pipeline_controlnet_union_inpaint_sd_xl.py", line 1393, in __call__
    if control_image:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Steps to Reproduce:

  1. Execute the above code sample in the ControlNet pipeline.
  2. Ensure all required inputs (prompt, original_img, mask, controlnet_img_pose, controlnet_img_canny, controlnet_img, negative_prompt, W, H) are properly defined.
  3. Run the script to generate images.
@muzammildafedar
Copy link
Author

after changing all/ any got another error during the run time

<class 'numpy.ndarray'>
<class 'int'>

Traceback (most recent call last):
  File "/content/ControlNetPlus/controlnet_union_test_inpainting.py", line 74, in <module>
    images = pipe(
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/content/ControlNetPlus/pipeline/pipeline_controlnet_union_inpaint_sd_xl.py", line 1393, in __call__
    if control_image.any():
AttributeError: 'int' object has no attribute 'any'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant