diff --git a/.dev_scripts/test_regression_txt2img_dream_v1_4.sh b/.dev_scripts/test_regression_txt2img_dream_v1_4.sh
index 11cbf8f14b..9326d3c311 100644
--- a/.dev_scripts/test_regression_txt2img_dream_v1_4.sh
+++ b/.dev_scripts/test_regression_txt2img_dream_v1_4.sh
@@ -5,8 +5,7 @@ SAMPLES_DIR=${OUT_DIR}
python scripts/dream.py \
--from_file ${PROMPT_FILE} \
--outdir ${OUT_DIR} \
- --sampler plms \
- --full_precision
+ --sampler plms
# original output by CompVis/stable-diffusion
IMAGE1=".dev_scripts/images/v1_4_astronaut_rides_horse_plms_step50_seed42.png"
diff --git a/.github/workflows/mkdocs-flow.yml b/.github/workflows/mkdocs-flow.yml
index c4a6365304..49a9cbd423 100644
--- a/.github/workflows/mkdocs-flow.yml
+++ b/.github/workflows/mkdocs-flow.yml
@@ -12,7 +12,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
- name: Build
uses: Tiryoh/actions-mkdocs@v0
with:
diff --git a/.github/workflows/test-dream-conda.yml b/.github/workflows/test-dream-conda.yml
index 3bd9b24582..6c51ebe718 100644
--- a/.github/workflows/test-dream-conda.yml
+++ b/.github/workflows/test-dream-conda.yml
@@ -85,9 +85,9 @@ jobs:
fi
# Utterly hacky, but I don't know how else to do this
if [[ ${{ github.ref }} == 'refs/heads/master' ]]; then
- time ${{ steps.vars.outputs.PYTHON_BIN }} scripts/dream.py --from_file tests/preflight_prompts.txt --full_precision
+ time ${{ steps.vars.outputs.PYTHON_BIN }} scripts/dream.py --from_file tests/preflight_prompts.txt
elif [[ ${{ github.ref }} == 'refs/heads/development' ]]; then
- time ${{ steps.vars.outputs.PYTHON_BIN }} scripts/dream.py --from_file tests/dev_prompts.txt --full_precision
+ time ${{ steps.vars.outputs.PYTHON_BIN }} scripts/dream.py --from_file tests/dev_prompts.txt
fi
mkdir -p outputs/img-samples
- name: Archive results
diff --git a/.gitignore b/.gitignore
index 6faecf6163..4c0ec37174 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,9 @@ outputs/
models/ldm/stable-diffusion-v1/model.ckpt
ldm/restoration/codeformer/weights
+# ignore the Anaconda/Miniconda installer used while building Docker image
+anaconda.sh
+
# ignore a directory which serves as a place for initial images
inputs/
diff --git a/.prettierrc.yaml b/.prettierrc.yaml
index 68eae1ba15..ce4b99a07b 100644
--- a/.prettierrc.yaml
+++ b/.prettierrc.yaml
@@ -5,9 +5,9 @@ singleQuote: true
quoteProps: as-needed
embeddedLanguageFormatting: auto
overrides:
- - files: "*.md"
+ - files: '*.md'
options:
proseWrap: always
- printWidth: 100
+ printWidth: 80
parser: markdown
cursorOffset: -1
diff --git a/README.md b/README.md
index d944be4951..cc026d9d88 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
InvokeAI: A Stable Diffusion Toolkit
# Stable Diffusion Dream Script
@@ -8,7 +8,7 @@
-# **Stable Diffusion Dream Script**
+# **InvokeAI - A Stable Diffusion Toolkit**
[![discord badge]][discord link]
[![latest release badge]][latest release link] [![github stars badge]][github stars link] [![github forks badge]][github forks link]
@@ -86,17 +86,14 @@ You wil need one of the following:
- At least 6 GB of free disk space for the machine learning model, Python, and all its dependencies.
-> Note
->
-> If you have an Nvidia 10xx series card (e.g. the 1080ti), please run the dream script in
-> full-precision mode as shown below.
+#### Note
-Similarly, specify full-precision mode on Apple M1 hardware.
-
-To run in full-precision mode, start `dream.py` with the `--full_precision` flag:
+Precision is auto configured based on the device. If however you encounter
+errors like 'expected type Float but found Half' or 'not implemented for Half'
+you can try starting `dream.py` with the `--precision=float32` flag:
```bash
-(ldm) ~/stable-diffusion$ python scripts/dream.py --full_precision
+(ldm) ~/stable-diffusion$ python scripts/dream.py --precision=float32
```
### Features
@@ -126,6 +123,11 @@ To run in full-precision mode, start `dream.py` with the `--full_precision` flag
### Latest Changes
+- vNEXT (TODO 2022)
+
+ - Deprecated `--full_precision` / `-F`. Simply omit it and `dream.py` will auto
+ configure. To switch away from auto use the new flag like `--precision=float32`.
+
- v1.14 (11 September 2022)
- Memory optimizations for small-RAM cards. 512x512 now possible on 4 GB GPUs.
diff --git a/docker-build/Dockerfile b/docker-build/Dockerfile
new file mode 100644
index 0000000000..dd6d898ce5
--- /dev/null
+++ b/docker-build/Dockerfile
@@ -0,0 +1,57 @@
+FROM debian
+
+ARG gsd
+ENV GITHUB_STABLE_DIFFUSION $gsd
+
+ARG rsd
+ENV REQS $rsd
+
+ARG cs
+ENV CONDA_SUBDIR $cs
+
+ENV PIP_EXISTS_ACTION="w"
+
+# TODO: Optimize image size
+
+SHELL ["/bin/bash", "-c"]
+
+WORKDIR /
+RUN apt update && apt upgrade -y \
+ && apt install -y \
+ git \
+ libgl1-mesa-glx \
+ libglib2.0-0 \
+ pip \
+ python3 \
+ && git clone $GITHUB_STABLE_DIFFUSION
+
+# Install Anaconda or Miniconda
+COPY anaconda.sh .
+RUN bash anaconda.sh -b -u -p /anaconda && /anaconda/bin/conda init bash
+
+# SD
+WORKDIR /stable-diffusion
+RUN source ~/.bashrc \
+ && conda create -y --name ldm && conda activate ldm \
+ && conda config --env --set subdir $CONDA_SUBDIR \
+ && pip3 install -r $REQS \
+ && pip3 install basicsr facexlib realesrgan \
+ && mkdir models/ldm/stable-diffusion-v1 \
+ && ln -s "/data/sd-v1-4.ckpt" models/ldm/stable-diffusion-v1/model.ckpt
+
+# Face restoreation
+# by default expected in a sibling directory to stable-diffusion
+WORKDIR /
+RUN git clone https://github.com/TencentARC/GFPGAN.git
+
+WORKDIR /GFPGAN
+RUN pip3 install -r requirements.txt \
+ && python3 setup.py develop \
+ && ln -s "/data/GFPGANv1.3.pth" experiments/pretrained_models/GFPGANv1.3.pth
+
+WORKDIR /stable-diffusion
+RUN python3 scripts/preload_models.py
+
+WORKDIR /
+COPY entrypoint.sh .
+ENTRYPOINT ["/entrypoint.sh"]
\ No newline at end of file
diff --git a/docker-build/entrypoint.sh b/docker-build/entrypoint.sh
new file mode 100755
index 0000000000..f47e6669e0
--- /dev/null
+++ b/docker-build/entrypoint.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+cd /stable-diffusion
+
+if [ $# -eq 0 ]; then
+ python3 scripts/dream.py --full_precision -o /data
+ # bash
+else
+ python3 scripts/dream.py --full_precision -o /data "$@"
+fi
\ No newline at end of file
diff --git a/assets/stable-samples/img2img/mountains-2.png b/docs/assets/stable-samples/img2img/mountains-2.png
similarity index 100%
rename from assets/stable-samples/img2img/mountains-2.png
rename to docs/assets/stable-samples/img2img/mountains-2.png
diff --git a/assets/stable-samples/img2img/mountains-3.png b/docs/assets/stable-samples/img2img/mountains-3.png
similarity index 100%
rename from assets/stable-samples/img2img/mountains-3.png
rename to docs/assets/stable-samples/img2img/mountains-3.png
diff --git a/assets/stable-samples/img2img/sketch-mountains-input.jpg b/docs/assets/stable-samples/img2img/sketch-mountains-input.jpg
similarity index 100%
rename from assets/stable-samples/img2img/sketch-mountains-input.jpg
rename to docs/assets/stable-samples/img2img/sketch-mountains-input.jpg
diff --git a/assets/stable-samples/txt2img/merged-0005.png b/docs/assets/stable-samples/txt2img/merged-0005.png
similarity index 100%
rename from assets/stable-samples/txt2img/merged-0005.png
rename to docs/assets/stable-samples/txt2img/merged-0005.png
diff --git a/assets/stable-samples/txt2img/merged-0006.png b/docs/assets/stable-samples/txt2img/merged-0006.png
similarity index 100%
rename from assets/stable-samples/txt2img/merged-0006.png
rename to docs/assets/stable-samples/txt2img/merged-0006.png
diff --git a/assets/stable-samples/txt2img/merged-0007.png b/docs/assets/stable-samples/txt2img/merged-0007.png
similarity index 100%
rename from assets/stable-samples/txt2img/merged-0007.png
rename to docs/assets/stable-samples/txt2img/merged-0007.png
diff --git a/assets/v1-variants-scores.jpg b/docs/assets/v1-variants-scores.jpg
similarity index 100%
rename from assets/v1-variants-scores.jpg
rename to docs/assets/v1-variants-scores.jpg
diff --git a/docs/features/CHANGELOG.md b/docs/features/CHANGELOG.md
index f50c4f11b8..a6258f6a56 100644
--- a/docs/features/CHANGELOG.md
+++ b/docs/features/CHANGELOG.md
@@ -2,6 +2,8 @@
title: Changelog
---
+# :octicons-log-16: Changelog
+
## v1.13 (in process)
- Supports a Google Colab notebook for a standalone server running on Google
diff --git a/docs/features/CLI.md b/docs/features/CLI.md
index 5f7cdaf162..aab695bbcd 100644
--- a/docs/features/CLI.md
+++ b/docs/features/CLI.md
@@ -1,27 +1,34 @@
---
title: CLI
+hide:
+ - toc
---
+# :material-bash: CLI
+
## **Interactive Command Line Interface**
The `dream.py` script, located in `scripts/dream.py`, provides an interactive interface to image
generation similar to the "dream mothership" bot that Stable AI provided on its Discord server.
-Unlike the txt2img.py and img2img.py scripts provided in the original CompViz/stable-diffusion
-source code repository, the time-consuming initialization of the AI model initialization only
-happens once. After that image generation from the command-line interface is very fast.
+Unlike the `txt2img.py` and `img2img.py` scripts provided in the original
+[CompVis/stable-diffusion](https://github.com/CompVis/stable-diffusion) source code repository, the
+time-consuming initialization of the AI model initialization only happens once. After that image
+generation from the command-line interface is very fast.
-The script uses the readline library to allow for in-line editing, command history (up and down
-arrows), autocompletion, and more. To help keep track of which prompts generated which images, the
+The script uses the readline library to allow for in-line editing, command history (++up++ and
+++down++), autocompletion, and more. To help keep track of which prompts generated which images, the
script writes a log file of image names and prompts to the selected output directory.
In addition, as of version 1.02, it also writes the prompt into the PNG file's metadata where it can
-be retrieved using scripts/images2prompt.py
+be retrieved using `scripts/images2prompt.py`
The script is confirmed to work on Linux, Windows and Mac systems.
-_Note:_ This script runs from the command-line or can be used as a Web application. The Web GUI is
-currently rudimentary, but a much better replacement is on its way.
+!!! note
+
+ This script runs from the command-line or can be used as a Web application. The Web GUI is
+ currently rudimentary, but a much better replacement is on its way.
```bash
(ldm) ~/stable-diffusion$ python3 ./scripts/dream.py
@@ -47,185 +54,197 @@ dream> q
00011.png: "there's a fly in my soup" -n6 -g -S 2685670268
```
-
-
-
+
The `dream>` prompt's arguments are pretty much identical to those used in the Discord bot, except
you don't need to type "!dream" (it doesn't hurt if you do). A significant change is that creation
-of individual images is now the default unless --grid (-g) is given. A full list is given in [List
-of prompt arguments] (#list-of-prompt-arguments).
+of individual images is now the default unless `--grid` (`-g`) is given. A full list is given in
+[List of prompt arguments](#list-of-prompt-arguments).
## Arguments
The script itself also recognizes a series of command-line switches that will change important
global defaults, such as the directory for image outputs and the location of the model weight files.
-## List of arguments recognized at the command line
+### List of arguments recognized at the command line
-These command-line arguments can be passed to dream.py when you first run it from the Windows, Mac
+These command-line arguments can be passed to `dream.py` when you first run it from the Windows, Mac
or Linux command line. Some set defaults that can be overridden on a per-prompt basis (see [List of
prompt arguments] (#list-of-prompt-arguments). Others
-| Argument | Shortcut | Default | Description |
-| :---------------------- | :---------: | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
-| --help | -h | | Print a concise help message. |
-| --outdir | -o | outputs/img_samples | Location for generated images. |
-| --prompt_as_dir | -p | False | Name output directories using the prompt text. |
-| --from_file | | None | Read list of prompts from a file. Use "-" to read from standard input |
-| --model | | stable-diffusion-1.4 | Loads model specified in configs/models.yaml. Currently one of "stable-diffusion-1.4" or "laion400m" |
-| --full_precision | -F | False | Run in slower full-precision mode. Needed for Macintosh M1/M2 hardware and some older video cards. |
-| --web | | False | Start in web server mode |
-| --host | | localhost | Which network interface web server should listen on. Set to 0.0.0.0 to listen on any. |
-| --port | | 9090 | Which port web server should listen for requests on. |
-| --config | | configs/models.yaml | Configuration file for models and their weights. |
-| --iterations | -n | 1 | How many images to generate per prompt. |
-| --grid | -g | False | Save all image series as a grid rather than individually. |
-| --sampler | -A | k_lms | Sampler to use. Use -h to get list of available samplers. |
-| --seamless | | False | Create interesting effects by tiling elements of the image. |
-| --embedding_path | | None | Path to pre-trained embedding manager checkpoints, for custom models |
-| --gfpgan_dir | | src/gfpgan | Path to where GFPGAN is installed. |
-| --gfpgan_model_path | | experiments/pretrained_models /GFPGANv1.3.pth | Path to GFPGAN model file, relative to --gfpgan_dir. |
-| --device | -d | torch.cuda.current_device() | Device to run SD on, e.g. "cuda:0" |
+| Argument | Shortcut | Default | Description |
+| ----------------------------------------- | ----------------------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
+| `--help` | `-h` | | Print a concise help message. |
+| `--outdir ` | `-o` | `outputs/img_samples` | Location for generated images. |
+| `--prompt_as_dir` | `-p` | `False` | Name output directories using the prompt text. |
+| `--from_file ` | | `None` | Read list of prompts from a file. Use `-` to read from standard input |
+| `--model ` | | `stable-diffusion-1.4` | Loads model specified in configs/models.yaml. Currently one of "stable-diffusion-1.4" or "laion400m" |
+| `--full_precision` | `-F` | `False` | Run in slower full-precision mode. Needed for Macintosh M1/M2 hardware and some older video cards. |
+| `--web` | | `False` | Start in web server mode |
+| `--host ` | | `localhost` | Which network interface web server should listen on. Set to 0.0.0.0 to listen on any. |
+| `--port ` | | `9090` | Which port web server should listen for requests on. |
+| `--config ` | | `configs/models.yaml` | Configuration file for models and their weights. |
+| `--iterations ` | `-n` | `1` | How many images to generate per prompt. |
+| `--grid` | `-g` | `False` | Save all image series as a grid rather than individually. |
+| `--sampler ` | `-A` | `k_lms` | Sampler to use. Use `-h` to get list of available samplers. |
+| `--seamless` | | `False` | Create interesting effects by tiling elements of the image. |
+| `--embedding_path ` | | `None` | Path to pre-trained embedding manager checkpoints, for custom models |
+| `--gfpgan_dir` | | `src/gfpgan` | Path to where GFPGAN is installed. |
+| `--gfpgan_model_path` | | `experiments/pretrained_models/GFPGANv1.3.pth` | Path to GFPGAN model file, relative to `--gfpgan_dir`. |
+| `--device ` | `-d` | `torch.cuda.current_device()` | Device to run SD on, e.g. "cuda:0" |
+
+#### deprecated
These arguments are deprecated but still work:
-| Argument | Shortcut | Default | Description |
-| ---------------- | -------- | ------- | --------------------------------------------------------------- |
-| --weights | | None | Pth to weights file; use `--model stable-diffusion-1.4` instead |
-| --laion400m | -l | False | Use older LAION400m weights; use `--model=laion400m` instead |
+
-### **A note on path names:**
+| Argument | Shortcut | Default | Description |
+| ------------------ | -------- | ------- | --------------------------------------------------------------- |
+| `--weights ` | | `None` | Pth to weights file; use `--model stable-diffusion-1.4` instead |
+| `--laion400m` | `-l` | `False` | Use older LAION400m weights; use `--model=laion400m` instead |
-On Windows systems, you may run into problems when passing the dream script standard backslashed
-path names because the Python interpreter treats "\" as an escape. You can either double your
-slashes (ick): `C:\\\\path\\\\to\\\\my\\\\file`, or use Linux/Mac style forward slashes (better):
-`C:/path/to/my/file`.
+
+
+!!! note
+
+ On Windows systems, you may run into problems when passing the dream script standard backslashed
+ path names because the Python interpreter treats `\` as an escape. You can either double your
+ slashes (ick): `C:\\path\\to\\my\\file`, or use Linux/Mac style forward slashes (better):
+ `C:/path/to/my/file`.
### List of prompt arguments
-After the dream.py script initializes, it will present you with a **dream>** prompt. Here you can
-enter information to generate images from text (txt2img), to embellish an existing image or sketch
-(img2img), or to selectively alter chosen regions of the image (inpainting).
+After the `dream.py` script initializes, it will present you with a **`dream>`** prompt. Here you
+can enter information to generate images from text (txt2img), to embellish an existing image or
+sketch (img2img), or to selectively alter chosen regions of the image (inpainting).
-### This is an example of txt2img
+#### txt2img
-```bash
-dream> "waterfall and rainbow" -W640 -H480
-```
+!!! example
-This will create the requested image with the dimensions 640 (width) and 480 (height).
+ ```bash
+ dream> "waterfall and rainbow" -W640 -H480
+ ```
+
+ This will create the requested image with the dimensions 640 (width) and 480 (height).
Those are the `dream` commands that apply to txt2img:
-| Argument | Shortcut | Default | Description |
-| --------------------------- | ---------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| "my prompt" | | | Text prompt to use. The quotation marks are optional. |
-| --width | -W | 512 | Width of generated image |
-| --height | -H | 512 | Height of generated image |
-| --iterations | -n | 1 | How many images to generate from this prompt |
-| --steps | -s | 50 | How many steps of refinement to apply |
-| --cfg_scale | -C | 7.5 | How hard to try to match the prompt to the generated image; any number greater than 0.0 works, but the useful range is roughly 5.0 to 20.0 |
-| --seed | -S | None | Set the random seed for the next series of images. This can be used to recreate an image generated previously. |
-| --sampler | -A | k_lms | Sampler to use. Use -h to get list of available samplers. |
-| --grid | -g | False | Turn on grid mode to return a single image combining all the images generated by this prompt |
-| --individual | -i | True | Turn off grid mode (deprecated; leave off --grid instead) |
-| --outdir | -o | outputs/img_samples | Temporarily change the location of these images |
-| --seamless | | False | Activate seamless tiling for interesting effects |
-| --log_tokenization | -t | False | Display a color-coded list of the parsed tokens derived from the prompt |
-| --skip_normalization | -x | False | Weighted subprompts will not be normalized. See [Weighted Prompts](./OTHER.md#weighted-prompts) |
-| --upscale | -U | -U 1 0.75 | Upscale image by magnification factor (2, 4), and set strength of upscaling (0.0-1.0). If strength not set, will default to 0.75. |
-| --gfpgan_strength | -G | -G0 | Fix faces using the GFPGAN algorithm; argument indicates how hard the algorithm should try (0.0-1.0) |
-| --save_original | -save_orig | False | When upscaling or fixing faces, this will cause the original image to be saved rather than replaced. |
-| --variation | -v | 0.0 | Add a bit of noise (0.0=none, 1.0=high) to the image in order to generate a series of variations. Usually used in combination with -S and -n to generate a series a riffs on a starting image. See [Variations](./VARIATIONS.md). |
-| --with_variations | -V | None | Combine two or more variations. See [Variations](./VARIATIONS.md) for now to use this. |
+| Argument | Shortcut | Default | Description |
+| ----------------------------------------- | ----------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `"my prompt"` | | | Text prompt to use. The quotation marks are optional. |
+| `--width ` | `-W` | `512` | Width of generated image |
+| `--height ` | `-H` | `512` | Height of generated image |
+| `--iterations ` | `-n` | `1` | How many images to generate from this prompt |
+| `--steps ` | `-s` | `50` | How many steps of refinement to apply |
+| `--cfg_scale ` | `-C` | `7.5` | How hard to try to match the prompt to the generated image; any number greater than 0.0 works, but the useful range is roughly 5.0 to 20.0 |
+| `--seed ` | `-S` | `None` | Set the random seed for the next series of images. This can be used to recreate an image generated previously. |
+| `--sampler ` | `-A` | `k_lms` | Sampler to use. Use `-h` to get list of available samplers. |
+| `--grid` | `-g` | `False` | Turn on grid mode to return a single image combining all the images generated by this prompt |
+| `--individual` | `-i` | `True` | Turn off grid mode (deprecated; leave off `--grid` instead) |
+| `--outdir ` | `-o` | `outputs/img_samples` | Temporarily change the location of these images |
+| `--seamless` | | `False` | Activate seamless tiling for interesting effects |
+| `--log_tokenization` | `-t` | `False` | Display a color-coded list of the parsed tokens derived from the prompt |
+| `--skip_normalization` | `-x` | `False` | Weighted subprompts will not be normalized. See [Weighted Prompts](./OTHER.md#weighted-prompts) |
+| `--upscale ` | `-U ` | `-U 1 0.75` | Upscale image by magnification factor (2, 4), and set strength of upscaling (0.0-1.0). If strength not set, will default to 0.75. |
+| `--gfpgan_strength ` | `-G ` | `-G0` | Fix faces using the GFPGAN algorithm; argument indicates how hard the algorithm should try (0.0-1.0) |
+| `--save_original` | `-save_orig` | `False` | When upscaling or fixing faces, this will cause the original image to be saved rather than replaced. |
+| `--variation ` | `-v` | `0.0` | Add a bit of noise (0.0=none, 1.0=high) to the image in order to generate a series of variations. Usually used in combination with `-S` and `-n` to generate a series a riffs on a starting image. See [Variations](./VARIATIONS.md). |
+| `--with_variations ` | `-V` | `None` | Combine two or more variations. See [Variations](./VARIATIONS.md) for now to use this. |
-Note that the width and height of the image must be multiples of 64. You can provide different
-values, but they will be rounded down to the nearest multiple of 64.
+!!! note
-### This is an example of img2img
+ The width and height of the image must be multiples of 64. You can provide different
+ values, but they will be rounded down to the nearest multiple of 64.
-```bash
-dream> waterfall and rainbow -I./vacation-photo.png -W640 -H480 --fit
-```
+#### img2img
-This will modify the indicated vacation photograph by making it more like the prompt. Results will
-vary greatly depending on what is in the image. We also ask to --fit the image into a box no bigger
-than 640x480. Otherwise the image size will be identical to the provided photo and you may run out
-of memory if it is large.
+!!! example
-Repeated chaining of img2img on an image can result in significant color shifts
-in the output, especially if run with lower strength. Color correction can be
-run against a reference image to fix this issue. Use the original input image to the
-chain as the the reference image for each step in the chain.
+ ```bash
+ dream> "waterfall and rainbow" -I./vacation-photo.png -W640 -H480 --fit
+ ```
+
+ This will modify the indicated vacation photograph by making it more like the prompt. Results will
+ vary greatly depending on what is in the image. We also ask to --fit the image into a box no bigger
+ than 640x480. Otherwise the image size will be identical to the provided photo and you may run out
+ of memory if it is large.
+
+Repeated chaining of img2img on an image can result in significant color shifts in the output,
+especially if run with lower strength. Color correction can be run against a reference image to fix
+this issue. Use the original input image to the chain as the the reference image for each step in
+the chain.
In addition to the command-line options recognized by txt2img, img2img accepts additional options:
-| Argument | Shortcut | Default | Description |
-| ------------------ | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
-| --init_img | -I | None | Path to the initialization image |
-| --init_color | | None | Path to reference image for color correction |
-| --fit | -F | False | Scale the image to fit into the specified -H and -W dimensions |
-| --strength | -s | 0.75 | How hard to try to match the prompt to the initial image. Ranges from 0.0-0.99, with higher values replacing the initial image completely. |
+| Argument | Shortcut | Default | Description |
+| ----------------------------------------- | ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
+| `--init_img ` | `-I` | `None` | Path to the initialization image |
+| `--init_color ` | | `None` | Path to reference image for color correction |
+| `--fit` | `-F` | `False` | Scale the image to fit into the specified -H and -W dimensions |
+| `--strength ` | `-f` | `0.75` | How hard to try to match the prompt to the initial image. Ranges from 0.0-0.99, with higher values replacing the initial image completely. |
-### This is an example of inpainting
+#### Inpainting
-```bash
-dream> "waterfall and rainbow" -I./vacation-photo.png -M./vacation-mask.png -W640 -H480 --fit
-```
+!!! example
-This will do the same thing as img2img, but image alterations will only occur within transparent
-areas defined by the mask file specified by -M. You may also supply just a single initial image with
-the areas to overpaint made transparent, but you must be careful not to destroy the pixels
-underneath when you create the transparent areas. See [Inpainting](./INPAINTING.md) for details.
+ ```bash
+ dream> "waterfall and rainbow" -I./vacation-photo.png -M./vacation-mask.png -W640 -H480 --fit
+ ```
-inpainting accepts all the arguments used for txt2img and img2img, as well as the --mask (-M)
+ This will do the same thing as img2img, but image alterations will only occur within transparent
+ areas defined by the mask file specified by `-M`. You may also supply just a single initial image with
+ the areas to overpaint made transparent, but you must be careful not to destroy the pixels
+ underneath when you create the transparent areas. See [Inpainting](./INPAINTING.md) for details.
+
+Inpainting accepts all the arguments used for txt2img and img2img, as well as the `--mask` (`-M`)
argument:
-| Argument | Shortcut | Default | Description |
-| ------------------ | -------- | ------- | ------------------------------------------------------------------------------------------------ |
-| --init_mask | -M | None | Path to an image the same size as the initial_image, with areas for inpainting made transparent. |
+| Argument | Shortcut | Default | Description |
+| ----------------------------------------- | ---------- | ------- | ------------------------------------------------------------------------------------------------ |
+| `--init_mask ` | `-M` | `None` | Path to an image the same size as the initial_image, with areas for inpainting made transparent. |
## Command-line editing and completion
If you are on a Macintosh or Linux machine, the command-line offers convenient history tracking,
editing, and command completion.
-- To scroll through previous commands and potentially edit/reuse them, use the up and down cursor
- keys.
-- To edit the current command, use the left and right cursor keys to position the cursor, and then
- backspace, delete or insert characters.
-- To move to the very beginning of the command, type CTRL-A (or command-A on the Mac)
-- To move to the end of the command, type CTRL-E.
+- To scroll through previous commands and potentially edit/reuse them, use the ++up++ and ++down++
+ cursor keys.
+- To edit the current command, use the ++left++ and ++right++ cursor keys to position the cursor,
+ and then ++backspace++, ++delete++ or ++insert++ characters.
+- To move to the very beginning of the command, type ++ctrl+a++ (or ++command+a++ on the Mac)
+- To move to the end of the command, type ++ctrl+e++.
- To cut a section of the command, position the cursor where you want to start cutting and type
- CTRL-K.
-- To paste a cut section back in, position the cursor where you want to paste, and type CTRL-Y
+ ++ctrl+k++.
+- To paste a cut section back in, position the cursor where you want to paste, and type ++ctrl+y++
-Windows users can get similar, but more limited, functionality if they launch dream.py with the
+Windows users can get similar, but more limited, functionality if they launch `dream.py` with the
"winpty" program:
-```
-> winpty python scripts\dream.py
+```batch
+winpty python scripts\dream.py
```
-On the Mac and Linux platforms, when you exit dream.py, the last 1000 lines of your command-line
-history will be saved. When you restart dream.py, you can access the saved history using the
-up-arrow key.
+On the Mac and Linux platforms, when you exit `dream.py`, the last 1000 lines of your command-line
+history will be saved. When you restart `dream.py`, you can access the saved history using the
+++up++ key.
In addition, limited command-line completion is installed. In various contexts, you can start typing
your command and press tab. A list of potential completions will be presented to you. You can then
type a little more, hit tab again, and eventually autocomplete what you want.
When specifying file paths using the one-letter shortcuts, the CLI will attempt to complete
-pathnames for you. This is most handy for the -I (init image) and -M (init mask) paths. To initiate
-completion, start the path with a slash ("/") or "./". For example:
+pathnames for you. This is most handy for the `-I` (init image) and `-M` (init mask) paths. To
+initiate completion, start the path with a slash `/` or `./`, for example:
-```
-dream> zebra with a mustache -I./test-pictures
+```bash
+dream> "zebra with a mustache" -I./test-pictures
-I./test-pictures/Lincoln-and-Parrot.png -I./test-pictures/zebra.jpg -I./test-pictures/madonna.png
-I./test-pictures/bad-sketch.png -I./test-pictures/man_with_eagle/
```
-You can then type "z", hit tab again, and it will autofill to "zebra.jpg".
+You can then type ++z++, hit ++tab++ again, and it will autofill to `zebra.jpg`.
More text completion features (such as autocompleting seeds) are on their way.
diff --git a/docs/features/EMBIGGEN.md b/docs/features/EMBIGGEN.md
index 70f35fe758..aecebf04e8 100644
--- a/docs/features/EMBIGGEN.md
+++ b/docs/features/EMBIGGEN.md
@@ -1,4 +1,10 @@
-# **Embiggen -- upscale your images on limited memory machines**
+---
+title: Embiggen
+---
+
+# :material-loupe: Embiggen
+
+**upscale your images on limited memory machines**
GFPGAN and Real-ESRGAN are both memory intensive. In order to avoid
crashes and memory overloads during the Stable Diffusion process,
@@ -16,7 +22,7 @@ face restore a particular generated image, pass it again with the same
prompt and generated seed along with the `-U` and `-G` prompt
arguments to perform those actions.
-## Embiggen
+## Embiggen
If you wanted to be able to do more (pixels) without running out of VRAM,
or you want to upscale with details that couldn't possibly appear
@@ -37,7 +43,7 @@ it's similar to that, except it can work up to an arbitrarily large size
has extra logic to re-run any number of the tile sub-sections of the image
if for example a small part of a huge run got messed up.
-**Usage**
+## Usage
`-embiggen `
@@ -55,7 +61,6 @@ and it can also be less than one if the init_img is too big.
Esrgan_strength defaults to 0.75, and the overlap_ratio defaults to
0.25, both are optional.
-
Unlike Img2Img, the `--width` (`-W`) and `--height` (`-H`) arguments
do not control the size of the image as a whole, but the size of the
tiles used to Embiggen the image.
@@ -95,12 +100,12 @@ Tiles are numbered starting with one, and left-to-right,
top-to-bottom. So, if you are generating a 3x3 tiled image, the
middle row would be `4 5 6`.
-**Example Usage**
+## Example Usage
Running Embiggen with 512x512 tiles on an existing image, scaling up by a factor of 2.5x;
and doing the same again (default ESRGAN strength is 0.75, default overlap between tiles is 0.25):
-```
+```bash
dream > a photo of a forest at sunset -s 100 -W 512 -H 512 -I outputs/forest.png -f 0.4 -embiggen 2.5
dream > a photo of a forest at sunset -s 100 -W 512 -H 512 -I outputs/forest.png -f 0.4 -embiggen 2.5 0.75 0.25
```
@@ -112,23 +117,23 @@ If there weren't enough clouds in the sky of that forest you just made
512x512 tiles with 0.25 overlaps wide) we can replace that top row of
tiles:
-```
+```bash
dream> a photo of puffy clouds over a forest at sunset -s 100 -W 512 -H 512 -I outputs/000002.seed.png -f 0.5 -embiggen_tiles 1 2 3
```
-**Note**
+!!! note
-Because the same prompt is used on all the tiled images, and the model
-doesn't have the context of anything outside the tile being run - it
-can end up creating repeated pattern (also called 'motifs') across all
-the tiles based on that prompt. The best way to combat this is
-lowering the `--strength` (`-f`) to stay more true to the init image,
-and increasing the number of steps so there is more compute-time to
-create the detail. Anecdotally `--strength` 0.35-0.45 works pretty
-well on most things. It may also work great in some examples even with
-the `--strength` set high for patterns, landscapes, or subjects that
-are more abstract. Because this is (relatively) fast, you can also
-always create a few Embiggen'ed images and manually composite them to
-preserve the best parts from each.
+ Because the same prompt is used on all the tiled images, and the model
+ doesn't have the context of anything outside the tile being run - it
+ can end up creating repeated pattern (also called 'motifs') across all
+ the tiles based on that prompt. The best way to combat this is
+ lowering the `--strength` (`-f`) to stay more true to the init image,
+ and increasing the number of steps so there is more compute-time to
+ create the detail. Anecdotally `--strength` 0.35-0.45 works pretty
+ well on most things. It may also work great in some examples even with
+ the `--strength` set high for patterns, landscapes, or subjects that
+ are more abstract. Because this is (relatively) fast, you can also
+ always create a few Embiggen'ed images and manually composite them to
+ preserve the best parts from each.
-Author: [Travco](https://github.com/travco)
\ No newline at end of file
+Author: [Travco](https://github.com/travco)
diff --git a/docs/features/IMG2IMG.md b/docs/features/IMG2IMG.md
index eeaecbf981..e61f365c01 100644
--- a/docs/features/IMG2IMG.md
+++ b/docs/features/IMG2IMG.md
@@ -2,7 +2,8 @@
title: Image-to-Image
---
-## **IMG2IMG**
+# :material-image-multiple: **IMG2IMG**
+
This script also provides an `img2img` feature that lets you seed your creations with an initial
drawing or photo. This is a really cool feature that tells stable diffusion to build the prompt on
top of the image you provide, preserving the original's basic shape and layout. To use it, provide
diff --git a/docs/features/INPAINTING.md b/docs/features/INPAINTING.md
index 317dc99698..d5857d7cdd 100644
--- a/docs/features/INPAINTING.md
+++ b/docs/features/INPAINTING.md
@@ -2,6 +2,8 @@
title: Inpainting
---
+# :octicons-paintbrush-16: Inpainting
+
## **Creating Transparent Regions for Inpainting**
Inpainting is really cool. To do it, you start with an initial image and use a photoeditor to make
@@ -26,6 +28,8 @@ dream> "man with cat on shoulder" -I./images/man.png -M./images/man-transparent.
We are hoping to get rid of the need for this workaround in an upcoming release.
+---
+
## Recipe for GIMP
[GIMP](https://www.gimp.org/) is a popular Linux photoediting tool.
@@ -34,7 +38,7 @@ We are hoping to get rid of the need for this workaround in an upcoming release.
2. Layer->Transparency->Add Alpha Channel
3. Use lasoo tool to select region to mask
4. Choose Select -> Float to create a floating selection
-5. Open the Layers toolbar (^L) and select "Floating Selection"
+5. Open the Layers toolbar (++ctrl+l++) and select "Floating Selection"
6. Set opacity to 0%
7. Export as PNG
8. In the export dialogue, Make sure the "Save colour values from
@@ -44,37 +48,41 @@ We are hoping to get rid of the need for this workaround in an upcoming release.
## Recipe for Adobe Photoshop
1. Open image in Photoshop
-
-
-
+
+
+ 
+
2. Use any of the selection tools (Marquee, Lasso, or Wand) to select the area you desire to inpaint.
-
-
-
-3. Because we'll be applying a mask over the area we want to preserve, you should now select the inverse by using the Shift + Ctrl + I shortcut, or right clicking and using the "Select Inverse" option.
+
+ 
+
-4. You'll now create a mask by selecting the image layer, and Masking the selection. Make sure that you don't delete any of the underlying image, or your inpainting results will be dramatically impacted.
-
-
-
+3. Because we'll be applying a mask over the area we want to preserve, you should now select the inverse by using the ++shift+ctrl+i++ shortcut, or right clicking and using the "Select Inverse" option.
+
+4. You'll now create a mask by selecting the image layer, and Masking the selection. Make sure that you don't delete any of the undrlying image, or your inpainting results will be dramatically impacted.
+
+
+ 
+
5. Make sure to hide any background layers that are present. You should see the mask applied to your image layer, and the image on your canvas should display the checkered background.
-
-
-
-
-
-
+
+ 
+
-6. Save the image as a transparent PNG by using the "Save a Copy" option in the File menu, or using the Alt + Ctrl + S keyboard shortcut.
+6. Save the image as a transparent PNG by using the "Save a Copy" option in the File menu, or using the Alt + Ctrl + S keyboard shortcut
+
+
+ 
+
7. After following the inpainting instructions above (either through the CLI or the Web UI), marvel at your newfound ability to selectively dream. Lookin' good!
-