The purpose
I’ll be creating prompts randomly from multiple word candidates in Stable Diffusion GUI.
I’m using the sd-dynamic-prompts extension for this.
Although it’s an extension for Automatic1111, I’ve confirmed it works with Forge.
Example
Here’s the translation:
The following is fixed:
”a girl,”
Randomly Selected from the Following:
”blue hair”、”yellow hair”
With a single “Generate” action, the following prompts will be automatically created and images will be generated. (Since it’s random, both may not necessarily be created every time.)
”a girl, blue hair”
”a girl, yellow hair”
install sd-dynamic-prompts
Open the “Install from URL” tab within the “Extensions” tab.
Enter the following URL into the “URL for extension’s git repository” field:
https://github.com/adieyal/sd-dynamic-prompts
Click “install”.

If the installation fails, please refer to the following article:
Restart Stable Diffusion to complete the installation.
Automatic Prompt Generation
Prepare
In the Txt2img or Img2img tab, click on the ◀ next to “Dynamic Prompts” (located below the Seed settings) to open the settings. Ensure that “Dynamic Prompts enabled” is checked.

Basic usage
Add the following syntax to your prompt:
During image generation, one item will be randomly selected from the defined set, and the prompt will be generated.
Text outside of {}
will be fixed and used every time.
{item1|item2|item3|...}
Specify the “Batch count” and click “Generate” to create images.
(If you set “Batch count” to 5, the prompt will be generated 5 times.)
Example
Prompt:
a girl, {blue|yellow} hair
Prompts Used During Image Generation:
a girl, blue hair
OR
a girl, yellow hair
How to Use Wildcards (Dictionary Files)
By including the following syntax in your prompt, one word will be randomly selected from your predefined list, and the prompt will be generated.
__group__
The underscore character _
should be typed twice.
You’ll define your words by creating a file named group.txt
within the webui\extensions\sd-dynamic-prompts\wildcards
directory. The group
in the filename will be the name of your prompt group.
item1
item2
Example
webui\extensions\sd-dynamic-prompts\wildcards¥color.txt:
yellow
blue
Prompt:
a girl, __color__ hair
Prompts Used During Image Generation:
a girl, blue hair
OR
a girl, yellow hair
How to Check the Prompts Used
The methods covered in this article generate prompts automatically, so the exact prompt used won’t be visible in the direct output.
Here’s how to check the actual prompt that was used for the last generated image.
How to confirm
Open the PNG Info tab.
Drag and drop your generated image into the source area on the left to display it.
After a brief moment, the prompt used for that image will appear on the right side (for example, “a girl, blue hair” in the example below).

Result
We have successfully managed to create prompts randomly from multiple word candidates in Stable Diffusion GUI.
comment