HomeAI News
[Stable Diffusion Advanced Skills] Prompt Syntax Detailed Explanation

[Stable Diffusion Advanced Skills] Prompt Syntax Detailed Explanation

March 21st, 2023
View OriginalTranslated by Google

Are you fed up with the prompts flying all over the sky? Are you still adding words and subtracting words? Are you still trying to keep adding and subtracting words? Still keep sending to t2i i2i jump in the image generation history and generated pages? You can try the following functions to automate your roll Graph Workflow

  • prompt weight change syntax
  • prompt matrix
  • X/Y/Z plot (previously called X/Y plot)
    • Prompt S/R
  • prompt edit
  • Save the self-made prompt style style.csv https://1/stable-diffusion-webui/wiki/Features#styles
  • Read the prompt from the txt file to generate pictures in batches

prompt weight change syntax

Using () in the hint will increase the model's attention to the surrounding words (that is, increase the weight), while [ ] will reduce the weight of the corresponding word (basically not needed)

The general process is to first write down the picture to be described and generate it, and then try to modify it. Use (xxx: 1.x ) to increase the weight of the concept to be emphasized in the unsatisfactory place

xxx is the word you want to emphasize 1.x represents the ratio to be improved, such as 1.5 is 150%

official wiki

prompt matrix prompt matrix

First select prompt matrix in the script script selection box at the bottom of the image generation interface to enable this syntax

Use | to split your prompt words, | will be every combination of words before and after it (if | is preceded by a and followed by b , then there will be no ab in the end; a; b; ab, a total of four pictures) each Generate a picture and put all the results into a matrix form, which is convenient for us to observe the contrast effect. It is often used when we conceive the style selection of the painting. For example, I want to see the picture below

How cyberpunk and steampunk affect the background can be added after the original prompt (cyberpunk:1.5) | (steampunk:1.5)

Finally, four pictures will be generated and merged into one matrix picture. The picture in the upper left corner contains neither cyberpunk nor steampunk in the prompt used to generate it. The prompt of the picture in the lower right corner contains both cyberpunk and steampunk. Steampunk

X/Y plot

The prompt matrix prompt matrix can be used when we compare several prompts of the same kind but do not conflict, but once the prompt words you want to compare are conflicting (that is, you cannot have me in you), it is not very competent , and the prompt matrix can only adjust the prompt but not other parameters. If you want to compare the images under different models, different sample step cfg vae... blah blah blah blah, you need to use X/Y plot at this time

X represents the horizontal axis Y represents the vertical axis

Compare parameters other than prompt

For example, compare the output effect of the same prompt parameters under different models ( why will it take a long time? If you have an A100 cluster, it will be fine... Because you need to switch models constantly, it is recommended to test the pan of each model only after the prompt and parameters are adjusted. It is used in the case of differences in cultural ability and learning ability)

Select x/y plot in the script list and pick the models you want to compare

X-axis horizontal contrast typesetting needs to be split into two rows

Put it on the Y axis for vertical comparison

In addition, almost all parameters can be compared in the x/y plot. I will not demonstrate them one by one here.

Compare conflicting prompts and do not require fusion of prompts: -> Prompt S/R

Prompt S/R is a sub-item under x/y plot. You can understand it as a more flexible and convenient prompt matrix (just don’t use the matrix but usually arrange it in a row). The usage is to match in the prompt to the place to be replaced and compare Enter the n similar words we want to compare into the input box of Prompt S/R in the format of comma➕space, and then click the generate button to generate n corresponding pictures


For example, if I want to see the impact of different camera positions on the picture, in addition to the overhead shooting, I also want to see the learning level of the flat shooting and upward shooting model. I can do as follows

prompt box

Prompt S/R script parameter filling


Comparing Models for Ethnic Cognition

prompt edit (doesn't feel very useful)

Sometimes we want certain words in the prompt

  • Stop working after the specified number of diffusion steps [from::when]
  • It takes effect after the specified number of diffusion steps [to:when]
  • Take a certain number of steps as the watershed before it is a word and then it becomes another word [from:to:when]

In the above cases, you can use the prompt edit function

The basic syntax is [from:to:when]

where from and to are arbitrary text, and when is a number defining how late in the sampling period the switch should occur. The later it is, the less power the model has to replace the from text with the to text. If when is a number between 0 and 1, it is a fraction of the number of steps to make the switch. If it is an integer greater than 0, it is the number of steps to make the switch.


The curly hair and bob cut gradients are switched from different processes to take effect. 0.8 means that only the last 20% of the time the bob cut takes effect

Save the self-made prompt style style.csv

Press the "Save hints as style" button to write your current hints to styles.csv, which is a collection of styles. To the right of the prompt there is a dropdown box that allows you to select any style from previously saved styles and automatically append it to your input. To delete a style, manually delete it from style.csv and restart the program.

If you use the placeholder {prompt} in your style, it will replace whatever is actually in the prompt box in that place instead of appending the style to your prompt.

official wiki

Read the prompt from the txt file to generate pictures in batches

Select prompts from file or textbox in the script box, and then you can fill in the path of the prepared txt file into the corresponding box or enter each line of text in the input box of the script to generate a corresponding picture

Reprinted from View Original


no dataCoffee time! Feel free to comment