thygate / stable-diffusion-webui-depthmap-script

High Resolution Depth Maps for Stable Diffusion WebUI
MIT License
1.72k stars 159 forks source link

IndexError: tuple index out of range #130

Open TheGoosePond opened 1 year ago

TheGoosePond commented 1 year ago

When I try to Generate 3D inpainted mesh, after rendering it just says "error" and it says IndexError: tuple index out of range. I'm not that good with code so maybe there's a simple solution to this that I just don't know so if there's any way for me to fix this then help would be appreciated! :)

100%|███████████████████████████████████████████████████████████████████████████████████| 1/1 [03:13<00:00, 193.02s/it] Done. Running 3D Photo Inpainting .. Downloading https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/edge-model.pth to ./models/3dphoto/edge_model.pth All done. Error completing request Arguments: (0, <PIL.Image.Image image mode=RGB size=1024x1024 at 0x23C67059FF0>, None, '', '', 0, 5, 512, 512, False, False, True, True, True, False, False, 1, False, False, 2.5, 4, 0, False, 0, 1, True, False, 'u2net', False, False, False, 0, 2) {} Traceback (most recent call last): File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1282, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1328, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1277, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1037, in _send_output self.send(msg) File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 975, in send self.connect() File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 1447, in connect super().connect() File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\http\client.py", line 941, in connect self.sock = self._create_connection( File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\socket.py", line 845, in create_connection raise err File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\socket.py", line 833, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\mjalm\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 591, in run_3dphoto download_file(edgemodel_path,"https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/edge-model.pth") File "C:\Users\mjalm\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 1356, in download_file torch.hub.download_url_to_file(url, filename) File "C:\Users\mjalm\stable-diffusion-webui\venv\lib\site-packages\torch\hub.py", line 597, in download_url_to_file u = urlopen(req) File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 216, in urlopen return opener.open(url, data, timeout) File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 519, in open response = self._open(req, data) File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 496, in _call_chain result = func(*args) File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, File "C:\Users\mjalm\AppData\Local\Programs\Python\Python310\lib\urllib\request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\mjalm\stable-diffusion-webui\modules\call_queue.py", line 56, in f res = list(func(*args, *kwargs)) File "C:\Users\mjalm\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(args, **kwargs) File "C:\Users\mjalm\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 1146, in run_generate outputs, mesh_fi = run_depthmap(None, outpath, imageArr, imageNameArr, compute_device, model_type, net_width, net_height, match_size, invert_depth, boost, save_depth, show_depth, show_heat, combine_output, combine_output_axis, gen_stereo, gen_anaglyph, stereo_divergence, stereo_fill, stereo_balance, clipdepth, clipthreshold_far, clipthreshold_near, inpaint, inpaint_vids, fnExt, vid_ssaa, background_removal, background_removed_images, save_background_removal_masks, False) File "C:\Users\mjalm\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 550, in run_depthmap mesh_fi = run_3dphoto(device, inpaint_imgs, inpaint_depths, inputnames, outpath, fnExt, vid_ssaa, inpaint_vids) File "C:\Users\mjalm\stable-diffusion-webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 713, in run_3dphoto del rgb_model UnboundLocalError: local variable 'rgb_model' referenced before assignment

Traceback (most recent call last): File "C:\Users\mjalm\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict output = await app.get_blocks().process_api( File "C:\Users\mjalm\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1018, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "C:\Users\mjalm\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 935, in postprocess_data if predictions[i] is components._Keywords.FINISHED_ITERATING: IndexError: tuple index out of range

umishima commented 1 year ago

Same here, please fix this url - https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/edge-model.pth

mrschneebly commented 1 year ago

What is the solution for this? Same problem here.

dnecra commented 1 year ago

For me "tuple index out of range" caused by corrupted model. By deleting the model from SD models folder, the script will redownload the models. In this case OP also had connection error, so I believe the models aren't downloaded properly.

xaviersykora commented 1 year ago

For me "tuple index out of range" caused by corrupted model. By deleting the model from SD models folder, the script will redownload the models. In this case OP also had connection error, so I believe the models aren't downloaded properly.

This solved the issue for me. Though, I had to manually redownload them in my browser and then drop them in the proper directory. "stable-diffusion-webui\models\3dphoto"

I noticed that the extension automatically downloaded a SECOND copy of all of the files, though they used a "_" instead of a "-" in the file names. I assume this mix up is what was causing the issue.

I downloaded the models here: https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/depth-model.pth https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/color-model.pth https://filebox.ece.vt.edu/~jbhuang/project/3DPhoto/model/edge-model.pth

JasonHoku commented 1 year ago

I seem to be only getting this error when trying to run with Batch Process or Batch from Directory, but Single Image is working without this error.