Stable Diffusion Infinity Grid Generator

Concept
Extension for the AUTOMATIC1111 Stable Diffusion WebUI that generates infinite-dimensional grids.
An "infinite axis grid" is like an X/Y plot grid, but with, well, more axes on it. Of course, monitors are 2D, so this is implemented in practice by generating a webpage that lets you select which two primary axes to display, and then choose the current value for each of the other axes.
Goals and Use Cases
The primary goal is to let people generate their own fancy grids to explore how different settings affect their renders in a convenient form.
Another goal of this system is to develop educational charts, to provide a universal answer to the classic question of "what does (X) setting do? But what about with (Y)?" - The MegaGrid. There is a built in ability to add description text to fields, for the specific purpose of enhancing educational page output.
Pros/Cons
The advantage of this design is it allows you to rapidly compare the results of different combinations of settings, without having to wait to for generation times for each specific sub-grid as-you-go - you just run it all once in advance (perhaps overnight for a large run), and then after that browse through it in realtime.
The disadvantage is that time to generate a grid is exponential - if you have 5 samplers, 5 seeds, 5 step counts, 5 CFG scales... that's 5^4, or 625 images. Add another variable with 5 options and now it's 3125 images. You can see how this quickly jumps from a two minute render to a two hour render.
Table of Contents
Examples
Here's a big MegaGrid using almost every mode option in one, with detailed educational descriptions on every part: https://sd.mcmonkey.org/megagrid/
Here's a very small web demo you can try to test how the output looks and works: https://mcmonkeyprojects.github.io/short_example and you can view the generated asset files for that demo here.

Status
Current overall project status (as of December 2023): Works well, actively maintained. Has been generally well tested. The core has been ported to other environments and stress-tested for multiple real projects that depend on large grids and rapid grid analysis.
A version of this project is also available for StableSwarmUI, here which also lets you use it with Comfy and other backends
Installation
- You must have the AUTOMATIC1111 Stable Diffusion WebUI already installed and working. Refer to that project's readme for help with that.
- Open the WebUI, go to to the
Extensions tab
- -EITHER- Option A:
- go to the
Available tab with
- click
Load from (with the default list)
- Scroll down to find
Infinity Grid Generator, or use CTRL+F to find it
- -OR- Option B:
- Click on
Install from URL
- Copy/paste this project's URL into the
URL for extension's git repository textbox: https://github.com/mcmonkeyprojects/sd-infinity-grid-generator-script
- Click
Install
- Restart or reload the WebUI
Basic Usage

- Basic usage is very simple!
- select the script under
Scripts
- Leave file as
Create in UI
- Select
Axis 1 Mode as whatever mode you want, like Seed or Sampler
- In the
Axis 1 Value box, you can type a comma-separated list like 1, 2, 3, or a double-pipe separated list like 1girl, booru style, prompt || 1boy, has commas, so pipes avoid problems
- Repeat for as many axes as you want. When you configure axis #4, it will automatically add 4 more rows of axes to fill in. Leave any extras empty.
- Click your main
Generate button and wait for it to finish.
- When it's done, click the button labeled
Page will be at (Click me) outputs/... to view the full page.
- Note that a
config.yml is saved in the output directory, which you can copy to your assets folder if you want to reuse it.
Advanced Usage
Usage comes in three main steps:
1: Grid Definition File

- Grid information is defined by YAML files, in the extension folder under
assets. Find the assets/short_example.yml file to see an example of the full format.
If you do not want to follow an example file:
- You can create new files in the assets directory (as long as the
.yml extension stays), or copy/paste an example file and edit it. I recommend you do not edit the actual example file directly to avoid git issues.
- I recommend editing with a good text editor, such as VS Code or Notepad++. Don't use MS Word or Windows Notepad as those might cause trouble.
- All text inputs allow for raw HTML, so, be careful. You can use
< for <, and > for >, : for :, and & for &.
- The file must have key
grid, with subkey title and description to define the file data.
- It must also have
format as jpg or png
- It can optionally also have
params to specify any default parameters.
- It can optionally define
show descriptions, autoscale, and sticky as true or false to change default web-viewer settings.
- It can optionally define
x axis, y axis, x super axis, and y super axis as axis IDs to change the default web-viewer axes.
- The file can optionally have key
variables with subkey/value pairs as replacements, for example (type): waffle - then later in a param value you can use a picture of a (type) to automatically fill the variable. These can be in any format you desire, as they are simple text replacements. They apply to all values, including titles, descriptions, and params (this was added for valconius in issue #16).
- The file must have key
axes to define the list of axes. This is a map-list key - meaning, add subkeys to create a list of each axis.
- The simplest format for an axis is a setting name as the key and a comma-separated list of values inside.
- For example,
seed: 1, 2, 3 is a valid and complete axis.
- If commas may be problematic, you many instead use two pipes
|| to separate values - for example prompt: 1girl, booru style, commas || 1boy, more commas, etc. If || is used, commas will be ignored for splitting
- For numeric inputs, you can use ellipses notation to quickly shorthand long lists. For example:
seed: 1, 2, ..., 10 automatically fills to 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Or, cfg scale: 7.0, 7.1, ..., 7.8 automatically fills to 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8.
- Note that you must have two entries before and one after - the step rate is defined as the space between the two prior and the total range is defined as between the one prior and the one after.
- You can use ellipses multiple times in one set, for example
1, 2, ..., 6, 8, ... 14 will fill to 1, 2, 3, 4, 5, 6, 8, 10, 12, 14 (note how 1-6 are spaced 1 apart, but 6-14 are spaced two apart).
- Each axis must have a
title, and values. It can optionally have a description.
- You can also optionally have
default: (value_id) to set the default selected tab.
- There are two ways to do a value in the value list:
- Option 1: just do like
steps=10 ... this will set title to 10, and param steps to value 10, with no description.
- Option 2: Add a submapping with key
title, and optional description, and then params as a sub map of parameters like steps: 10
- A value with a full format can be set to skip rendering via adding
skip: true. This is useful for eg if some values are only valid in certain combinations, you can do runs with some skipped. Skipped values will be kept in the HTML output.
- A value may specify
show: false to default uncheck the 'Show value' advanced option.
Micro example:
grid:
title: Tiny example
author: someone
description: This is just to show core format. View the example `.yml` files in assets for better examples.
format: jpg
axes:
sampler: Euler, DDIM
seed: 1, 2, 3
- Names and descriptions can always be whatever you want, as HTML text.
Settings supported for parameters
| Name |
Type |
Example |
Notes |
Sampler |
Named |
DDIM, euler, ... |
|
Model |
Filename |
sd-v1-5 |
Note that Model and VAE are global settings, and as such you should not have an axis where some values specify one of those params but others don't, as this will cause an unpredictable model selection for the values that lack specificity. |
VAE |
Filename |
kl-f8-anime2 |
See note on Model above |
Prompt |
Text |
a cat |
|
Negative Prompt |
Text |
gross, weird, bad |
|
Prompt Replace |
Text-Pair |
some_tag = new text here |
Note the = symbol to separate the original text with the new text. That will change a prompt of for example my prompt with some_tag stuff to my prompt with new text here stuff. Unlike other modes, the PromptReplace is case-sensitive - if you use capitals in your prompt, you need capitals in your replace matcher. If you want multiple replacements in one value, you can number them, like Prompt Replace 1 and Prompt Replace 2 and etc. When building a simple list in UI, you can just do eg cat, dog, waffle and it will understand to replace cat in the base prompt first with cat, then dog, then waffle (ie you can skip the = for simple usages). |
Styles |
Text |
photo, cartoon, ... |
Automatically includes UI styles to your prompt. Can use comma-separated list to have multiple. Note this means in the UI you can do for example `photo, cinematic |
Seed |
Integer |
1, 2, 3, ... |
|
Steps |
Integer |
20, 50, ... |
|
CFG Scale |
Decimal |
5, 7.5, 12, ... |
|
Width |
Integer |
512, 768, ... |
Initial generation width. |
Height |
Integer |
512, 768, ... |
Initial generation height. |
Out Width |
Integer |
512, 768, ... |
What resolution to save the image as (if unspecified, uses Width). Useful to save filespace. |
Out Height |
Integer |
512, 768, ... |
Refer to Out Width. |