Dynamic Prompts
Powerful prompt templating syntax to vary prompt text between Batch Generations
Last updated
Was this helpful?
Powerful prompt templating syntax to vary prompt text between Batch Generations
Last updated
Was this helpful?
When requesting images from Sogni’s Relaxed and Fast Supernet you may leverage an advanced text variation syntax {} to outline different prompt text for each image requested from your single prompt, as seen in the example above.
This advanced syntax is called Dynamic Prompts and is a popular advanced "prompt templating" feature for professional AI Artists. It has been popularized by SD Dynamic Prompts and each of these Dynamic Prompt Samplers: Combination Prompts, Cyclical Prompts, and Random Prompts are available for your prompts using Sogni Supernet.
Combination Prompts
The most basic and popular "Prompt Variant Sampler" is the Combination Prompt. To leverage this feature in the text of your prompt all you have to do is put 2 or more text fragments inside of curly braces {} within your prompt. The words or phrases need to be separated by a | (Pipe) character. The curly brace can be around your entire prompt to completely change prompts for each image or just a small portion of the text.
For example a prompt for “A woman with {black|blonde} hair” will generate 2 prompts:
Prompt 1: A woman with black hair Prompt 2: A woman with blonde hair
If you then request a batch of 4 images, image 1 will use Prompt 1 and image 2 will use Prompt 2.
When you have more images requested than prompt combinations generated then the next set of images will loop back to the start of your combinations. So Image 3 will use Prompt 1, and image 4 will use Prompt 2.
You can add spaces inside the curly brace options to make the prompt more readable for yourself and those spaces will be ignored. So these 2 examples will produce the same images:
“A woman with {black|blonde} hair” “A woman with { black | blonde } hair”
There is no limit to the number of options you can include in the curly braces and you may include multiple curly brace combinations in your prompt. The only limiting factor is the overall prompt box character limit as well as being sure to request a minimum number of batch images to meet the number of variations you are requesting. For example this prompt: {man|woman} holding a {dog|cat} in the {winter|summer}
will generate 2 x 2 x 2 = 8 prompt variations so you should hit 9 on the image count tab bar.
man holding a dog in the winter man holding a dog in the summer man holding a cat in the winter man holding a cat in the summer woman holding a dog in the winter woman holding a dog in the summer woman holding a cat in the winter woman holding a cat in the summer man holding a dog in the winter <- image 9 cycles back to the first prompt
Cyclical Prompts
You can also convert your Combination Prompt into a "Cyclical" sampling prompt by simply adding a ~ (tilda) character after your opening curly brace. Cyclical iterates every pair of { option 1 | option 2 | ... } combinations in your prompt at the same time. The pattern is repeated until the image count requested is reached.
For example 4 Images requested for: I {~love|hate} {~New York|Chicago} Will generate prompts: I love New York I hate Chicago I love New York I hate Chicago Random Prompts
You may also convert your Combination Prompt into a Random Prompt by simply putting an @ after your opening curly brace. This picks 1 option at random from the list of options instead of incrementing them sequentially. As chance is random, you may get the same random option multiple times.
For example 4 images requested for: I {@love|hate|enjoy|miss} New York May generate I enjoy New York I miss New York I enjoy New York I hate New York
Weighted Random Prompts
When using "Random" sampling you may also add weights to each option in your curly braces to control their relative frequency. To do this, add a double colon :: followed by the weight before the option. The weights are relative and do not have to add up to 1. If you omit a weight, it is assumed to be 1.
For example a prompt of: I {@75::love|25::hate} New York Will have a 75% chance of generating "I love New York" and a 25% chance of generating "I hate New York" for each image requested.
You can mix and match sampling methods like using a combination sampler and a random sampler together in the same prompt. For example 4 Images requested for: I {love|hate|enjoy|miss} {@75::New York|25::Chicago} May generate I love New York I hate Chicago I enjoy New York I miss New York The weighted random feature is particularly powerful. A common use case is to be able to add variable scarcity based traits when generating 10,000 NFT characters.
You may use this feature in any or all of the prompt fields: Prompt, Style, Avoid / Negative Prompt.
One additional tip:
If you want the composition and other elements of the images generated from your prompt variations to stay as similar as possible be sure to use a “fixed seed”. This means locking the Seed number so it doesn’t change between generations. You can also explore using Guide Image and Controlnet features with this feature.
Note: The final images displayed in your Sogni App from a Combination Prompt batch image request may not appear in the prompt order outlined above since image jobs are done by several worker machines in parallel and are displayed to you in the order they are completed and downloaded by your machine.
▶️ Tutorial video: Sogni AI Prompt Engineering: Your Guide to Stunning Results
Need help? Ask in our Discord!
For any questions regarding the use of Sogni, tips, suggestions, bugs, sharing art, discussing AI and life, or simply hanging out... Join our Discord community! Join Sogni Discord ✨