hako-mikan / sd-webui-regional-prompter

set prompt to divided region
GNU Affero General Public License v3.0
1.49k stars 120 forks source link

Error when using LORAs in latent mode #126

Closed sashasubbbb closed 1 year ago

sashasubbbb commented 1 year ago

When i try to use any loras in prompt in latent mode i get this error:

Error running process_batch: B:\AIimages\stable-diffusion-webui\extensions\sd-webui-regional-prompter\scripts\rp.py
Traceback (most recent call last):
  File "B:\AIimages\stable-diffusion-webui\modules\scripts.py", line 436, in process_batch
    script.process_batch(p, *script_args, **kwargs)
  File "B:\AIimages\stable-diffusion-webui\extensions\sd-webui-regional-prompter\scripts\rp.py", line 363, in process_batch
    lora_namer(self, p, lnter, lnur)
  File "B:\AIimages\stable-diffusion-webui\extensions\sd-webui-regional-prompter\scripts\latent.py", line 223, in lora_namer
    regioner.ndeleter(lnter, lnur, lorder)
  File "B:\AIimages\stable-diffusion-webui\extensions\sd-webui-regional-prompter\scripts\latent.py", line 318, in ndeleter
    self.te_llist[0][key] *= val
KeyError: 'concept_add_brightness'

Am i doing something wrong?

Symbiomatrix commented 1 year ago

This indicates that one of the loras you're using is missing or named differently from the complete list. Not sure how that's possible. First, I'll need the prompt you've used along with base / common settings. Second, I don't have debug prints in that function, so if you could add the line print("regioner", regioner.te_llist, regioner_ullist) before the line regioner.ndeleter(lnter, lnur, lorder) in latent.py, rerun and tell us wait it shows before the error, that'd be swell.

sashasubbbb commented 1 year ago

Here's the error

regioner [{'concept_add_brightnessadded_by_regional_prompter0.13180439031496294': 1.0, 'clothes_roundGlasses_v1a_bestadded_by_regional_prompter0.05037024887722352': 1.0}, {'concept_add_brightnessadded_by_regional_prompter0.13180439031496294': 1.0, 'clothes_roundGlasses_v1a_bestadded_by_regional_prompter0.05037024887722352': 0}, {'concept_add_brightnessadded_by_regional_prompter0.13180439031496294': 0, 'clothes_roundGlasses_v1a_bestadded_by_regional_prompter0.05037024887722352': 1.0}] [{'concept_add_brightnessadded_by_regional_prompter0.13180439031496294': 1.0, 'clothes_roundGlasses_v1a_bestadded_by_regional_prompter0.05037024887722352': 0}, {'concept_add_brightnessadded_by_regional_prompter0.13180439031496294': 0, 'clothes_roundGlasses_v1a_bestadded_by_regional_prompter0.05037024887722352': 1.0}, {'concept_add_brightnessadded_by_regional_prompter0.13180439031496294': 1.0, 'clothes_roundGlasses_v1a_bestadded_by_regional_prompter0.05037024887722352': 1.0}]
Error running process_batch: B:\AIimages\stable-diffusion-webui\extensions\sd-webui-regional-prompter\scripts\rp.py
Traceback (most recent call last):
  File "B:\AIimages\stable-diffusion-webui\modules\scripts.py", line 463, in process_batch
    script.process_batch(p, *script_args, **kwargs)
  File "B:\AIimages\stable-diffusion-webui\extensions\sd-webui-regional-prompter\scripts\rp.py", line 363, in process_batch
    lora_namer(self, p, lnter, lnur)
  File "B:\AIimages\stable-diffusion-webui\extensions\sd-webui-regional-prompter\scripts\latent.py", line 224, in lora_namer
    regioner.ndeleter(lnter, lnur, lorder)
  File "B:\AIimages\stable-diffusion-webui\extensions\sd-webui-regional-prompter\scripts\latent.py", line 319, in ndeleter
    self.te_llist[0][key] *= val
KeyError: 'concept_add_brightness'

Screenshot at 14-12-48

Screenshot at 14-13-11

Everything else default.

Symbiomatrix commented 1 year ago

Blast, forgot that "added_by" auto tagging thing on the new version. Thanks, I'll have a PR up for it in a jiffy. Btw, seems that the best negative combination for these loras is 0,1 for brightness / glasses respectively, although the corruption is fairly unnoticeable even at 0,0.

Edit: That should do it, have a go if you like.

AIShank commented 1 year ago

Was this issue fixed? If so how do I apply the fix, because the latest version of the extension is still giving me this error.

Symbiomatrix commented 1 year ago

@AIShank Should be, per my testing on vlad's, and faramour's. No actions necessary beyond updating the extension and resetting. Same rules apply - describe what you did, post the errors, preferably with debug mode on (I added the above print along with the fix).