[SD Advanced Tutoria]Change prompt word parameters

[SD Advanced Tutoria]Change prompt word parameters

AI  Learning Assistant No 1
AI Learning Assistant No 1
August 22nd, 2023

Stable Diffusion Software

We will focus on Stable Diffusion AI. While some parameters mentioned in this article are available in free online AI generators, all of them are available in this popular Stable Diffusion GUI (AUTOMATIC1111). See my quick start guide for setting up in Google’s cloud server.

CFG Scale

Classifier Free Guidance scale is a parameter to control how much the model should respect your prompt.

1 – Mostly ignore your prompt. 3 – Be more creative. 7 – A good balance between following the prompt and freedom. 15 – Adhere more to prompt. 30 – Strictly follow the prompt.

Below are a few examples of increasing the CFG scale with the same random seed. In general, you should stay away from the two extremes – 1 and 30.

Recommendation: Starts with 7. Increase if you want it to follow your prompt more.

Higher CFG scale adheres more to the prompt.

Sampling steps

Quality improves as the sampling step increases. Typically 20 steps with Euler sampler is enough to reach a high quality, sharp image. Although the image will still change subtly when stepping through to higher values, it will become different but not necessarily higher quality.

Recommendation: 20 steps. Adjust to higher if you suspect quality is low.

Increasing sampling steps.

Sampling methods

There’s a variety of sampling methods you can choose, depending on what GUI you are using. They are simply different methods for solving diffusion equations. They are supposed to give the same result but could be slightly different due numerical bias. But since there’s no right answer here – the only criteria is the image looks good, accuracy of the method should not be your concern.

Not all methods are created equal. Below are the processing time of various methods.

Rendering time for 20 steps.

Below are images produced after 20 steps.

Images produced after 20 steps

There are discussions in online community claiming that certain sampling methods tend to yield particular styles. This is without theoretical merit. My suggestion is to keep things simple: 20 steps with Euler.

Recommendation: Euler.


Seed dialog box

The random seed determines the initialize noise pattern and hence the final image.

Setting it to -1 means using a random one every time. It is useful when you want to generate new images. On the other hand, fixing it would result in the same images in each new generation.

How to find the seed used for an image if you use random seed? In the dialog box, you should see something like:

Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 4239744034, Size: 512×512, Model hash: 7460a6fa

Simply copy this seed value to seed input box. If you generate more than one image at a time, the seed value of the second image is this number incremented by 1, and so on. Alternatively, click the recycle button to reuse the seed from the last generation.

Recommendation: Set to -1 to explore. Fix to a value for fine-tuning.

Image size

The size of output image. Since Stable Diffusion is trained with 512×512 images, setting it to portrait or landscape sizes can create unexpected issues. Leave it as square whenever possible.

Recommendation: Set image size as 512×512.

Batch size

Batch size is the number of images generated each time. Since the final images are very dependent on the random seed, it is always a good idea to generate a few images at a time. This way, you can get a good sense of what the current prompt can do.

Recommendation: Set batch size to 4 or 8.

Restore faces

A dirty little secret of Stable Diffusion is that it often has issues with faces and eyes. Restore faces is a post-processing method applied to images using AI trained specifically to correct faces.

To turn it on, check the box next to Restore faces. Go to Settings tab, under Face restoration model, select CodeFormer.

Below are two examples. Without face restoration is on the left. With face restoration is on the right.

Recommendation: Turn restore faces on when you generate images with faces.

Reprinted from View Original
Collection Navigation
# 1 [SD Advanced Tutoria]How to fix parameters?
# 2 [SD Advanced Tutorial]How to automatically fix faces and hands
# 3 [SD Advanced Tutorial]How to run SDXL models
# 4 [SD Advanced Tutorial]Speed up Stable Diffusion
# 5 [SD Advanced Tutorial]3 ways to control lighting in Stable Diffusion
# 6 [SD Advanced Tutorial]Video to video with Stable Diffusion
# 7 [SD Advanced Tutorial]3 methods to upscale images in SD
# 8 [SD Advanced Tutorial]Control image composition in SD
# 9 [SD Advanced Tutorial]How to generate animals in SD
# 10 [SD Advanced Tutorial]How to make a video with SD
# 11 [SD Advanced Tutorial]How to generate realistic people in SD
# 12 [SD Advanced Tutorial]Stable Diffusion SDXL Beta Model
# 13 [SD Advanced Tutorial]SD Samplers: A Comprehensive Guide
# 14 [SD Advanced Tutorial]Midjourney vs SD: Which one should you pick?
# 15 [SD Advanced Tutorial]What is hypernetwork
# 16 [SD Advanced Tutorial]AUTOMATIC1111: A Beginner’s Guide
# 17 [SD Advanced Tutoria]What are LoRA models and how to use them in AUTOMATIC1111
# 18 [SD Advanced Tutoria]ControlNet v1.1: A complete guide
# 19 [SD Advanced Tutoria]How to remove extra limbs with Stable Diffusion inpainting
# 20 [SD Advanced Tutoria]Stable Diffusion prompt: a definitive guide
# 21 [SD Advanced Tutoria]Instruct Pix2Pix: Edit and stylize photos with text
# 22 [SD Advanced Tutoria]How to use outpainting to extend images
# 23 [SD Advanced Tutoria]ChatGPT: How to generate prompts for Stable Diffusion
# 24 [SD Advanced Tutoria]How to run Stable Diffusion on Google Colab (AUTOMATIC1111)
# 25 [SD Advanced Tutoria]Stable Diffusion Installation Tutorial (Mac M1/M2)
# 26 [SD Advanced Tutoria]How to use negative prompts?
# 27 [SD Advanced Tutoria]How does negative prompt work?
# 28 [SD Advanced Tutoria]How does Stable Diffusion work?
# 29 [SD Advanced Tutoria]Stable Diffusion Workflow
# 30 [SD Advanced Tutoria]Depth-to-image in SD 2
# 31 [SD Advanced Tutoria]How to install SD on Windows
# 32 [SD Advanced Tutoria]How to use embeddings in Stable Diffusion
# 33 [SD Advanced Tutoria]How to install Stable Diffusion 2.1 in AUTOMATIC1111 GUI
# 34 [SD Advanced Tutoria]How to cartoonize photo with Stable Diffusion
# 35 [SD Advanced Tutoria]How to use Dreambooth to put anything in Stable Diffusion (Colab notebook)
# 36 [SD Advanced Tutoria]How to use VAE to improve eyes and faces
# 37 [SD Advanced Tutoria]Turn amateur into professional with img2img
# 38 [SD Advanced Tutoria]How to use AI image upscaler to improve details
# 39 [SD Advanced Tutoria]How to run Stable Diffusion 2.0 and a first look
# 40 [SD Advanced Tutoria]A Beginner's Guide to SD Models
# 41 [SD Advanced Tutoria]How to stylize images using Stable Diffusion AI
# 42 [SD Advanced Tutoria]Basic information of Stable Diffusion
# 43 [SD Advanced Tutoria]Top Free Stable Diffusion AI Image Generator Sites
# 44 [SD Advanced Tutoria]Image AI generates fashion ideas
# 45 [SD Advanced Tutoria]Make an Animated GIF Using SD
# 46 [SD Advanced Tutoria]Common Problems in AI
# 47 [SD Advanced Tutoria]Change prompt word parameters
# 48 [SD Advanced Tutoria]AI removes unwanted objects
# 49 [SD Advanced Tutoria]Fine-tune AI images with tips
# 50 [SD Advanced Tutoria]What is Stable Diffusion?


no dataCoffee time! Feel free to comment