v0xie / sd-webui-incantations

Enhance Stable Diffusion image quality, prompt following, and more through multiple implementations of novel algorithms for Automatic1111 WebUI.
GNU General Public License v3.0
139 stars 9 forks source link

Seek for Incantations - multi word bracket error () #15

Open Miczu opened 8 months ago

Miczu commented 8 months ago

When I run "Seek for Incantations", I get "IndexError: list index out of range" exception. I was able to narrow it down to being related to having bracket () around multiple words in modes without "Deepbooru Interrogate" checked. "Append Generated Caption" didn't affect the error occurence.

Example prompts that work correctly: green forest (green) forest green (forest) (green) (forest)

Prompt that throw exception: (green forest) (green forest:1.2)

Brackets around multi token single word are fine.

100%|██████████████████████████████████████████████████████████████████████████████████| 24/24 [00:04<00:00, 5.45it/s] Error running postprocess_batch: M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incantation_base.py Traceback (most recent call last): File "M:\ML\1111\stable-diffusion-webui\modules\scripts.py", line 758, in postprocess_batch script.postprocess_batch(p, script_args, images=images, kwargs) File "M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incantation_base.py", line 91, in postprocess_batch m.module.postprocess_batch(p, self.m_args(m, args), *kwargs) File "M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incant.py", line 426, in postprocess_batch return self.incant_postprocess_batch(p, args, **kwargs) File "M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incant.py", line 454, in incant_postprocess_batch batch_mask_prompts.append(self.mask_prompt(incant_params.gamma, matches, caption, incant_params.word)) File "M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incant.py", line 540, in mask_prompt masked_prompt = re.sub(repl_regex, word_repl, masked_prompt) File "C:\Programy_MR\Python_3_10_6\lib\re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) File "C:\Programy_MR\Python_3_10_6\lib\re.py", line 303, in _compile p = sre_compile.compile(pattern, flags) File "C:\Programy_MR\Python_3_10_6\lib\sre_compile.py", line 788, in compile p = sre_parse.parse(p, flags) File "C:\Programy_MR\Python_3_10_6\lib\sre_parse.py", line 955, in parse p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0) File "C:\Programy_MR\Python_3_10_6\lib\sre_parse.py", line 444, in _parse_sub itemsappend(_parse(source, state, verbose, nested + 1, File "C:\Programy_MR\Python_3_10_6\lib\sre_parse.py", line 843, in _parse raise source.error("missing ), unterminated subpattern", re.error: missing ), unterminated subpattern at position 2


Error running before_process_batch: M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incantation_base.py Traceback (most recent call last): File "M:\ML\1111\stable-diffusion-webui\modules\scripts.py", line 726, in before_process_batch script.before_process_batch(p, script_args, kwargs) File "M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incantation_base.py", line 83, in before_process_batch m.module.before_process_batch(p, self.m_args(m, args), *kwargs) File "M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incant.py", line 276, in before_process_batch self.incant_before_process_batch(p, args, **kwargs) File "M:\ML\1111\stable-diffusion-webui\extensions_sd-webui-incantations\scripts\incant.py", line 308, in incant_before_process_batch masked_prompts = self.stage_1.masked_prompt[mask_idx] IndexError: list index out of range