私がChatGPTなどに質問したことを書いていくブログ

Chat GPTヘビーユーザーの管理人が、日常に役立つことからどうでもいいことまで様々な質問をまとめたブログです。

*** Error running process: C:\stable-diffusion-webui\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py.11it/s] Traceback (most recent call last): File "C:\stable-diffusion-webui\modules\scripts.py", line 832, in process script.p

*** Error running process: C:\stable-diffusion-webui\extensions\sd-dynamic-prompts\scripts\dynamic_prompting.py.11it/s] Traceback (most recent call last): File "C:\stable-diffusion-webui\modules\scripts.py", line 832, in process script.process(p, *script_args) File "C:\stable-diffusion-webui\extensions\sd-dynamic-prompts\sd_dynamic_prompts\dynamic_prompting.py", line 480, in process all_prompts, all_negative_prompts = generate_prompts( File "C:\stable-diffusion-webui\extensions\sd-dynamic-prompts\sd_dynamic_prompts\helpers.py", line 93, in generate_prompts all_prompts = prompt_generator.generate(prompt, num_prompts, seeds=seeds) or [""] File "C:\stable-diffusion-webui\venv\lib\site-packages\dynamicprompts\generators\randomprompt.py", line 67, in generate gen = self._context.sample_prompts(template, num_images) File "C:\stable-diffusion-webui\venv\lib\site-packages\dynamicprompts\sampling_context.py", line 119, in sample_prompts command = parse(prompt, parser_config=self.parser_config) File "C:\stable-diffusion-webui\venv\lib\site-packages\dynamicprompts\parser\parse.py", line 557, in parse tokens = get_cached_parser(parser_config).parse_string( File "C:\stable-diffusion-webui\venv\lib\site-packages\pyparsing\core.py", line 1212, in parse_string raise exc.with_traceback(None) pyparsing.exceptions.ParseException: Expected end of text, found '_' (at char 200), (line:7, col:15) このエラーはなんですか?
 
ChatGPT:

とても良い質問です。
このエラーは 「sd-dynamic-prompts」拡張機能のプロンプト構文が壊れている(正しくパースできない) という意味です。


🔍 エラーの要点

 
pyparsing.exceptions.ParseException: Expected end of text, found '_' (at char 200), (line:7, col:15)

この部分が最も重要です。

  • pyparsing は、sd-dynamic-prompts が使っている「プロンプト構文パーサー」です。

  • 「Expected end of text, found '_'」=
    「テキストの終わりを期待していたのに _(アンダースコア)が現れた」
    ということは、構文上おかしい文字 _ がプロンプトの途中にあるという意味です。


💡 よくある原因

以下のようなプロンプトを使っていませんか?

 
{girl|boy|_person}
 
{red_hair|blue_hair}
 
{theme_forest}

これらは sd-dynamic-prompts では構文エラーになります。
_ を含む単語は基本的にOKですが、
「{}」「[]」「|」などの動的構文の中にアンダースコアを含むトークがあると
一部のバージョンでは誤解釈してエラーになります。


✅ 対処法

  1. エラーの出たプロンプトを見直す

    • 特に { ... }[ ... ]| を含む箇所。

    • その中で _ が入っていないか確認。

  2. アンダースコアを削除または置き換える
    例:

    • red_hair"red hair"

    • {theme_forest|theme_city}{forest theme|city theme}

  3. 一時的に dynamic prompts をオフにする

    • WebUI の「拡張機能」→「sd-dynamic-prompts」→ チェックを外す。

    • 正常に動作すれば、原因はこの拡張機能の構文。

  4. dynamic-prompts を最新にアップデートする

     
    cd C:\stable-diffusion-webui\extensions\sd-dynamic-prompts git pull

    その後 WebUI を再起動。


🔧 もし直らない場合

該当プロンプト(エラーを出した行)を貼ってもらえれば、
どの部分が原因か正確に指摘して修正版を出せます。