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

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices #155

Open
kbahaaeldin opened this issue Jul 30, 2024 · 12 comments

Comments

@kbahaaeldin
Copy link

0: 1600x1216 99 objects, 147.1ms
Speed: 9.1ms preprocess, 147.1ms inference, 138.1ms postprocess per image at shape (1, 3, 1600, 1216)
2024-07-30 14:37:22,015 - Inpaint Anything - INFO - sam_masks: 99
Processing segments: 100%|█████████████████████████████████████████████████████████████| 99/99 [00:03<00:00, 32.92it/s]
Traceback (most recent call last):
File "D:\system\python\lib\site-packages\gradio\queueing.py", line 536, in process_events
response = await route_utils.call_process_api(
File "D:\system\python\lib\site-packages\gradio\route_utils.py", line 276, in call_process_api
output = await app.get_blocks().process_api(
File "D:\system\python\lib\site-packages\gradio\blocks.py", line 1923, in process_api
result = await self.call_function(
File "D:\system\python\lib\site-packages\gradio\blocks.py", line 1508, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "D:\system\python\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\system\python\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\system\python\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\system\python\lib\site-packages\gradio\utils.py", line 818, in wrapper
response = f(*args, **kwargs)
File "D:\webui\extensions\sd-webui-inpaint-anything\ia_threading.py", line 165, in wrapper
res = func(*args, **kwargs)
File "D:\webui\extensions\sd-webui-inpaint-anything\ia_threading.py", line 125, in wrapper
res = func(*args, **kwargs)
File "D:\webui\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py", line 207, in run_sam
if sam_image["image"].shape == seg_image.shape and np.all(sam_image["image"] == seg_image):
IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

@frankea
Copy link

frankea commented Aug 9, 2024

Same error here.

2024-08-09 13:53:18,805 - Inpaint Anything - INFO - input_image: (960, 720, 3) uint8
2024-08-09 13:53:22,623 - Inpaint Anything - INFO - SamAutomaticMaskGenerator sam_vit_h_4b8939.pth
2024-08-09 13:53:27,599 - Inpaint Anything - INFO - sam_masks: 43
Processing segments: 100%|█████████████████████████████████████████████████████████████| 43/43 [00:00<00:00, 58.70it/s]
Traceback (most recent call last):
File "F:\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\queueing.py", line 536, in process_events
response = await route_utils.call_process_api(
File "F:\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\route_utils.py", line 285, in call_process_api
output = await app.get_blocks().process_api(
File "F:\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\blocks.py", line 1923, in process_api
result = await self.call_function(
File "F:\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\blocks.py", line 1508, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "F:\stable-diffusion-webui-forge\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "F:\stable-diffusion-webui-forge\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "F:\stable-diffusion-webui-forge\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run
result = context.run(func, *args)
File "F:\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\utils.py", line 818, in wrapper
response = f(*args, **kwargs)
File "F:\stable-diffusion-webui-forge\extensions\sd-webui-inpaint-anything\ia_threading.py", line 165, in wrapper
res = func(*args, **kwargs)
File "F:\stable-diffusion-webui-forge\extensions\sd-webui-inpaint-anything\ia_threading.py", line 125, in wrapper
res = func(*args, **kwargs)
File "F:\stable-diffusion-webui-forge\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py", line 208, in run_sam
if sam_image["image"].shape == seg_image.shape and np.all(sam_image["image"] == seg_image):
IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

I did also notice this error on launch:

2024-08-09 13:52:17,891 - ControlNet - INFO - ControlNet UI callback registered.
F:\stable-diffusion-webui-forge\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py:1193: GradioDeprecationWarning: unexpected argument for Image: tool
sam_image = gr.Image(label="Segment Anything image", elem_id="ia_sam_image", type="numpy", tool="sketch", brush_radius=8,
F:\stable-diffusion-webui-forge\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py:1193: GradioDeprecationWarning: unexpected argument for Image: brush_radius
sam_image = gr.Image(label="Segment Anything image", elem_id="ia_sam_image", type="numpy", tool="sketch", brush_radius=8,
F:\stable-diffusion-webui-forge\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py:1209: GradioDeprecationWarning: unexpected argument for Image: tool
sel_mask = gr.Image(label="Selected mask image", elem_id="ia_sel_mask", type="numpy", tool="sketch", brush_radius=12,
F:\stable-diffusion-webui-forge\extensions\sd-webui-inpaint-anything\scripts\inpaint_anything.py:1209: GradioDeprecationWarning: unexpected argument for Image: brush_radius
sel_mask = gr.Image(label="Selected mask image", elem_id="ia_sel_mask", type="numpy", tool="sketch", brush_radius=12,
Loading parameters: {'checkpoint_info': {'filename': 'F:\stable-diffusion-webui-forge\models\Stable-diffusion\picxReal_10.safetensors', 'hash': '8bae17e6'}, 'vae_filename': None, 'unet_storage_dtype': None}
Running on local URL: http://127.0.0.1:7860

@Uminosachi
Copy link
Owner

I have tightened the conditions in the if statement when returning images. Please update and try it out.

@frankea
Copy link

frankea commented Aug 10, 2024

I have tightened the conditions in the if statement when returning images. Please update and try it out.

It does indeed run successfully now, however after it runs the mouse is just a normal cursor and I can't paint anything to create a mask.

@Uminosachi
Copy link
Owner

The gradio package within the venv might be corrupted. Try deleting the venv folder under stable-diffusion-webui and then restart the webui.bat.

For Windows:

rmdir /s venv
webui.bat

@frankea
Copy link

frankea commented Aug 12, 2024

The gradio package within the venv might be corrupted. Try deleting the venv folder under stable-diffusion-webui and then restart the webui.bat.

For Windows:

rmdir /s venv
webui.bat

I did that and got an error regarding PATH, so I ran webui-user.bat which reinstalled everything in the VENV. After doing so, the issue persists where I only have a normal mouse cursor. Tried in Firefox and Chrome with the same results.

There also appear to be three new buttons below the images, for Upload, Camera, and Paste.

@Uminosachi
Copy link
Owner

Duplicate of #154

@Uminosachi Uminosachi marked this as a duplicate of #154 Aug 12, 2024
@Uminosachi
Copy link
Owner

This repository currently does not support version 4 of the Gradio package used in stable-diffusion-webui-forge.

@hanetyb
Copy link

hanetyb commented Sep 14, 2024

i meet the same issue that its failed to create mask without cursor , will you have a plan to upgrade to support gradio 4?

@Uminosachi
Copy link
Owner

At the moment, I don't have plans to support Gradio 4 due to some existing bugs in the ImageEditor component, particularly issues like image misalignment when used within gradio.Row().

@jkw117
Copy link

jkw117 commented Sep 16, 2024

If their are any workarounds I'd appreciate it.

@Bruce20090827
Copy link

So sd-forge-webui is not supported ?

@Uminosachi
Copy link
Owner

This repository is for AUTOMATIC1111/stable-diffusion-webui and does not support Gradio 4 Forge.

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

6 participants