Categories
Tutorials

Stable Diffusion Automatic1111 Default Settings (No More Manual Work)

Every time I open Stable Diffusion via Automatic1111, I find myself having to set everything again — image dimensions, sampling rate, models, etc.

Sometimes, I just want to do a quick query and find out whether Stable Diffusion can help me produce the artwork I need.

So I hatched a plan. Here’s what can really help you create an efficient Stable Diffusion workflow that reduces time-to-output.

Table of Contents

Setting default values in Automatic1111 is super easy

When you open up Automatic1111, you might notice that your settings revert to specific default settings.

For example, your dimensions might be 512px by 512px. Euler appears as the default sampler.

I don’t use Euler anymore. I use DPM ++ 2M Karras with 20-30 steps, as recommended by Andrew from Stable Diffusion Art, who recommended:

  1. If you want to use something fast, converging, new, and with decent quality, excellent choices are
    • DPM++ 2M Karras with 20 – 30 steps
    • UniPC with 20-30 steps.
  2. If you want good quality images and don’t care about convergence, good choices are
    • DPM++ SDE Karras with 8-12 steps (Note: This is a slower sampler)
    • DDIM with 10-15 steps.
  3. Avoid using any ancestral samplers if you prefer stable, reproducible images.
  4. Euler and Heun are fine choices if you prefer something simple. Reduce the number of steps for Heun to save time.

Andrew, from Stable Diffusion Art

The other thing is that I want to be able to increase the default dimensions to 768x768px, given that models are moving towards that size.

Let’s see how we can set those.

Navigate to your Stable Diffusion folder.

My path is: C:\stable-diffusion\stable-diffusion-webui

In the root folder, you will see two important files: config.json and ui-config.json.

Modifying ui-config.json

I opened ui-config.json in Visual Studio Code, but you can use Notepad if you don’t have VS Code.

You might want to create a backup copy of this file, in case you mess up.

The file is written in JSON, so make sure to keep all the punctuation intact. Some punctuation that you’ll repeatedly see:

  • Comma at the end of each line;
  • Quotation marks must have an open and a closing quotation;
  • An opening parenthesis and a closing one at the start and the end of the JSON file.

Don’t Just Refresh. Reload UI.

Do not just press F5 to refresh. You will need to Reload UI in the Settings tab.

This is what you have before:

After saving the modified ui-config.json file, and reloading the UI, you should see new defaults.

change default sampler and pixel dimensions stable diffusion

Change Stable Diffusion Default Sampler to DPM++ 2M Karras

I’ve had good results with this sampler, so I want to change my txt2img and img2img default sampler.

Look for the values on the left, and then change whatever is on the right to the sampler you want.

In my case, it’s “DPM++ 2M Karras”,

"txt2img/Sampling method/value": "DPM++ 2M Karras",
[...]
"img2img/Sampling method/value": "DPM++ 2M Karras",

Change Stable Diffusion Default Dimensions to 768px Square

If your default model uses 512px, keep it as it is.

But my default model is trained for 768px, so I changed the following key-value pairs to 768px.

Replace the 512 with 768.

"txt2img/Width/value": 512,
"txt2img/Height/value": 512,
"img2img/Width/value": 512,
"img2img/Height/value": 512,

Change Stable Diffusion Default Sampling Steps

If you want to change the sampling steps, run a find command for this: Sampling Steps/value

You should get four matching key-value pairs:

“txt2img/Sampling Steps/value”: 20,
“img2img/Sampling Steps/value”: 20,

Note: for some reason, my ui-config.json had four Sampling Steps/Values, rather than the expected two.

I didn’t experience any problems by just changing all four key-value pairs from 20 steps to 25 steps.

But it makes me feel that there’s a bug somewhere which is causing the repetition of key-value pairs.

Change default batch count in Stable Diffusion ui-config

Find “Batch count/value”. You should see:

  "img2img/Batch count/value": 1,
  "txt2img/Batch count/value": 1,

You can change the value from 1 to 4. Four images will give you a better idea of what your prompt will produce without committing too much time.

Default negative prompt

I generally don’t generate nude nor black and white images, so I always put these in my negative prompt.

"img2img/Negative prompt/value": "b&w, nude, naked"

If you always want something in your prompt or negative prompt, search out the phrase:

"txt2img/Prompt/value": "[your default prompt here]",

"txt2img/Negative prompt/value": "b&w, nude, naked",

Those key-value pairs are for txt2img. Just replace it with img2img if you want to set the defaults for img2img.

Change Stable Diffusion default CFG Scale

Find “CFG Scale/value”. Edit that to whatever you want.

I didn’t edit this because I generally don’t know what CFG value I need until I ran the next step.

Setting X/Y/Z plot defaults

change default xyz plot values in stable diffusion

One central workflow component involves running a CFG scale plot.

In the past, I used to manually click and enter the CFG values into the X/Y/Z custom script plot.

It defaults to Seed on the X-axis and Nothing for the Y and Z plots.

However, I always ran a CFG plot with odd numbers from 1 to 15.

This way I can know which CFG works well with my prompt and desired outcome.

Here’s an example of why it’s important to run this. As you can see, things get a bit too fake on the extremes of the CFG scale here.

So let’s see how we can set that up the XYZ plot defaults in ui-config.

The lines that you need to edit are:

"customscript/xyz_grid.py/txt2img/X type/value": "CFG Scale",
"customscript/xyz_grid.py/txt2img/X values/value": "1,3,5,7,9,11,13,15",

img2img

For img2img, I generally run the same CFG scale plot, but I also add in denoising strength modifiers into the Y-axis plot.

stable diffusion cartoon image x/y plot

The image above came from my article about converting your selfie into a cartoon avatar.

As you can see from the image above, things do change as your denoising and CFG values change!

So let’s put in some values. Search for

"customscript/xyz_grid.py/img2img/X type/value": "CFG Scale",

"customscript/xyz_grid.py/img2img/X values/value": "1,3,5,7,9,11,13,15",

"customscript/xyz_grid.py/img2img/Y type/value": "Denoising",

"customscript/xyz_grid.py/img2img/Y values/value": "0.2,0.4,0.6,0.8,1.0",

With this, you can easily activate the script and have all of these values pop up instantly.

You no longer have to write the values and select the variable.

If you have changed the default batch count, make sure to reduce it to 1 when you run the X/Y/Z plot.

Changing Stable Diffusion default model

It seems like you can’t set your default model.

Here’s why. You can declare your default model in config.json (not ui-config.json) under the key-value pair:

"sd_model_checkpoint": "comicDiffusion_v2.ckpt [d3c225cbc2]",

But if you ever change your model in Automatic1111, you’ll find that your config.json gets modified.

You might say, “let’s disable write access”.

But that might mean you’ll lose your changes if you modify anything in the Settings tab.

Not worth it, in my opinion. This is something I’m OK if I can’t set a default.

Have a project in mind?

Websites. Graphics. SEO-oriented content.

I can get your next project off the ground.

See how I have helped my clients.