multi-subject-render icon indicating copy to clipboard operation
multi-subject-render copied to clipboard

UnboundLocalError: local variable 'model' referenced before assignment error when internet is turned off?

Open wakariah opened this issue 3 years ago • 6 comments

When I have no internet I get this error. UnboundLocalError: local variable 'model' referenced before assignment

Any easy way to fix this? I also know nothing about coding so maybe this is obvious

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users#\stable-diffusion-webui\modules\ui.py", line 185, in f res = list(func(*args, **kwargs)) File "C:\Users#\stable-diffusion-webui\webui.py", line 57, in f res = func(*args, **kwargs) File "C:\Users#\stable-diffusion-webui\modules\txt2img.py", line 46, in txt2img processed = modules.scripts.scripts_txt2img.run(p, *args) File "C:\Users#\stable-diffusion-webui\modules\scripts.py", line 317, in run processed = script.run(p, *script_args) File "C:\Users#\stable-diffusion-webui\extensions\multi-subject-render\scripts\multirender.py", line 244, in run foreground_image_mask = sdmg.calculate_depth_map_for_waifus(foreground_image) File "C:\Users#\stable-diffusion-webui\extensions/multi-subject-render/scripts/simple_depthmap.py", line 130, in calculate_depth_map_for_waifus del model UnboundLocalError: local variable 'model' referenced before assignment

this is what ive got

wakariah avatar Nov 26 '22 00:11 wakariah

Did you update the script? I had that error while I was developping it.

Extraltodeus avatar Nov 26 '22 00:11 Extraltodeus

I did update it just now and I'm still getting it. but weirdly I only get the error if my internet is off yeah its so weird bc otherwise it's working very well but I know nothing even remotely about coding, I also disabled my other extensions so its not an interaction from what I can tell

wakariah avatar Nov 26 '22 00:11 wakariah

This might be related to the midas repository. The error comes from the module that interacts with it. I am not sure to be able to solve it right away.

Extraltodeus avatar Nov 26 '22 01:11 Extraltodeus

interesting, I was messing with the depth2image extension earlier with no problem, such a weird error. hope it isnt too hard to fix, good luck! let me know if you know any workarounds! thanks so much for the reply

wakariah avatar Nov 26 '22 01:11 wakariah

somebody has found a fix to it lol https://fr.reddit.com/r/StableDiffusion/comments/z4muxu/my_depth2mask_extension_is_ready_works_with_15/ixsggnr/?context=3

  1. in blocks.py def _make_pretrained_efficientnet_lite3, add source='local', after "tf_efficientnet_lite3",

  2. in webui folder create folders \rwightman\gen-efficientnet-pytorch and copy the repo from .cache\ torch\ hub\

I'll implement it as soon as I get back to it

Extraltodeus avatar Nov 26 '22 02:11 Extraltodeus

I just updated this project and I am getting this error whenever I use any model except for midas_v21_small. I am connected to the internet fine and all the models download fine.

jstanley14 avatar Jan 11 '23 18:01 jstanley14