hako-mikan / sd-webui-lora-block-weight

1.12k stars 100 forks source link

local variable 'errormodules' referenced before assignment #162

Closed jim60105 closed 1 month ago

jim60105 commented 4 months ago

local variable 'errormodules' referenced before assignment

*** Error running after_extra_networks_activate: /data/extensions/sd-webui-lora-block-weight/scripts/lora_block_weight.py
    Traceback (most recent call last):
      File "/app/modules/scripts.py", line 819, in after_extra_networks_activate
        script.after_extra_networks_activate(p, *script_args, **kwargs)
      File "/data/extensions/sd-webui-lora-block-weight/scripts/lora_block_weight.py", line 541, in after_extra_networks_activate
        loradealer(self, kwargs["prompts"] ,self.lratios,self.elementals,kwargs["extra_network_data"])
      File "/data/extensions/sd-webui-lora-block-weight/scripts/lora_block_weight.py", line 893, in loradealer
        if go_lbw or load: load_loras_blocks(self, lorans,lorars,te_multipliers,unet_multipliers,elements,ltype, starts=starts)
      File "/data/extensions/sd-webui-lora-block-weight/scripts/lora_block_weight.py", line 975, in load_loras_blocks
        lbwf(te, unet, lwei, elements, starts)
      File "/data/extensions/sd-webui-lora-block-weight/scripts/lora_block_weight.py", line 1159, in lbwf
        if len(errormodules) > 0:
    UnboundLocalError: local variable 'errormodules' referenced before assignment

The errormodules is initialized inside the for loop at line 1142 and then used at line 1159.

https://github.com/hako-mikan/sd-webui-lora-block-weight/blob/4d94d247a6e6d77c11c2d536a5138a54f4d9e500/scripts/lora_block_weight.py#L1139-L1160

hako-mikan commented 2 months ago

It should likely be fixed in the latest update. Please give it a try.