Error when trying to run locally

#2
by petermg - opened

I'm getting the following error when running this locally:

Traceback (most recent call last):
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\queueing.py", line 489, in call_prediction
output = await route_utils.call_process_api(
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\route_utils.py", line 232, in call_process_api
output = await app.get_blocks().process_api(
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\blocks.py", line 1533, in process_api
result = await self.call_function(
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\blocks.py", line 1151, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio_backends_asyncio.py", line 2134, in run_sync_in_worker_thread
return await future
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\anyio_backends_asyncio.py", line 851, in run
result = context.run(func, *args)
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\utils.py", line 678, in wrapper
response = f(*args, **kwargs)
File "D:\AI\PatchFusion\app.py", line 208, in process
detected_map = predict_depth(depth_model, input_image, mode, patch_number, [resolution_h, resolution_w], [patch_size_h, patch_size_w], device=DEVICE, preprocess=preprocess)
File "D:\AI\PatchFusion\ui_prediction.py", line 143, in predict_depth
image_lr = preprocess(image)
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\torchvision\transforms\transforms.py", line 95, in call
img = t(img)
File "D:\AI\PatchFusion\zoedepth\models\base_models\midas.py", line 173, in call
return nn.functional.interpolate(x, (height, width), mode='bilinear', align_corners=True)
File "C:\Users\pgomb\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\nn\functional.py", line 3924, in interpolate
raise TypeError(
TypeError: expected size to be one of int or Tuple[int] or Tuple[int, int] or Tuple[int, int, int], but got size with types [<class 'numpy.int32'>, <class 'numpy.int32'>]

I'm having the same problem, and I'm finding that the RAM required to run it is very large.

I'm having the same problem, and I'm finding that the RAM required to run it is very large.

I found the work around here:
https://github.com/Fannovel16/comfyui_controlnet_aux/issues/2#issuecomment-1752018444
You have to modify a line in a couple of files. The path to the files probably will be different than what the link shows just look at your error message and it will show you. But this is what the link says to do:

to fix this:
file /comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py replace line 176 with

return nn.functional.interpolate(x, (int(height), int(width)), mode='bilinear', align_corners=True)

file /comfyui_controlnet_aux/src/custom_midas_repo/midas/backbones/beit.py replace line 47 with

new_sub_table = F.interpolate(old_sub_table, size=(int(new_height), int(new_width)), mode="bilinear")

I'm having the same problem, and I'm finding that the RAM required to run it is very large.

I found the work around here:
https://github.com/Fannovel16/comfyui_controlnet_aux/issues/2#issuecomment-1752018444
You have to modify a line in a couple of files. The path to the files probably will be different than what the link shows just look at your error message and it will show you. But this is what the link says to do:

to fix this:
file /comfyui_controlnet_aux/src/controlnet_aux/zoe/zoedepth/models/base_models/midas.py replace line 176 with

return nn.functional.interpolate(x, (int(height), int(width)), mode='bilinear', align_corners=True)

file /comfyui_controlnet_aux/src/custom_midas_repo/midas/backbones/beit.py replace line 47 with

new_sub_table = F.interpolate(old_sub_table, size=(int(new_height), int(new_width)), mode="bilinear")

It works!! Thank you for your response!

Sign up or log in to comment