most (all?) references to CLI deprecated

This commit is contained in:
Lincoln Stein 2023-05-31 21:29:52 -04:00
parent a0b6654f6a
commit 3c40e7fc1c
6 changed files with 66 additions and 143 deletions

View File

@ -71,6 +71,3 @@ under the selected name and register it with InvokeAI.
use InvokeAI conventions - only alphanumeric letters and the use InvokeAI conventions - only alphanumeric letters and the
characters ".+-". characters ".+-".
## Caveats
This is a new script and may contain bugs.

View File

@ -31,10 +31,22 @@ turned on and off on the command line using `--nsfw_checker` and
At installation time, InvokeAI will ask whether the checker should be At installation time, InvokeAI will ask whether the checker should be
activated by default (neither argument given on the command line). The activated by default (neither argument given on the command line). The
response is stored in the InvokeAI initialization file (usually response is stored in the InvokeAI initialization file
`invokeai.init` in your home directory). You can change the default at any (`invokeai.yaml` in the InvokeAI root directory). You can change the
time by opening this file in a text editor and commenting or default at any time by opening this file in a text editor and
uncommenting the line `--nsfw_checker`. changing the line `nsfw_checker:` from true to false or vice-versa:
```
...
Features:
esrgan: true
internet_available: true
log_tokenization: false
nsfw_checker: true
patchmatch: true
restore: true
```
## Caveats ## Caveats
@ -79,11 +91,3 @@ generates. However, it does write metadata into the PNG data area,
including the prompt used to generate the image and relevant parameter including the prompt used to generate the image and relevant parameter
settings. These fields can be examined using the `sd-metadata.py` settings. These fields can be examined using the `sd-metadata.py`
script that comes with the InvokeAI package. script that comes with the InvokeAI package.
Note that several other Stable Diffusion distributions offer
wavelet-based "invisible" watermarking. We have experimented with the
library used to generate these watermarks and have reached the
conclusion that while the watermarking library may be adding
watermarks to PNG images, the currently available version is unable to
retrieve them successfully. If and when a functioning version of the
library becomes available, we will offer this feature as well.

View File

@ -18,43 +18,16 @@ Output Example:
## **Seamless Tiling** ## **Seamless Tiling**
The seamless tiling mode causes generated images to seamlessly tile with itself. To use it, add the The seamless tiling mode causes generated images to seamlessly tile
`--seamless` option when starting the script which will result in all generated images to tile, or with itself creating repetitive wallpaper-like patterns. To use it,
for each `invoke>` prompt as shown here: activate the Seamless Tiling option in the Web GUI and then select
whether to tile on the X (horizontal) and/or Y (vertical) axes. Tiling
will then be active for the next set of generations.
A nice prompt to test seamless tiling with is:
```python
invoke> "pond garden with lotus by claude monet" --seamless -s100 -n4
``` ```
pond garden with lotus by claude monet"
By default this will tile on both the X and Y axes. However, you can also specify specific axes to tile on with `--seamless_axes`.
Possible values are `x`, `y`, and `x,y`:
```python
invoke> "pond garden with lotus by claude monet" --seamless --seamless_axes=x -s100 -n4
```
---
## **Shortcuts: Reusing Seeds**
Since it is so common to reuse seeds while refining a prompt, there is now a shortcut as of version
1.11. Provide a `-S` (or `--seed`) switch of `-1` to use the seed of the most recent image
generated. If you produced multiple images with the `-n` switch, then you can go back further
using `-2`, `-3`, etc. up to the first image generated by the previous command. Sorry, but you can't go
back further than one command.
Here's an example of using this to do a quick refinement. It also illustrates using the new `-G`
switch to turn on upscaling and face enhancement (see previous section):
```bash
invoke> a cute child playing hopscotch -G0.5
[...]
outputs/img-samples/000039.3498014304.png: "a cute child playing hopscotch" -s50 -W512 -H512 -C7.5 -mk_lms -S3498014304
# I wonder what it will look like if I bump up the steps and set facial enhancement to full strength?
invoke> a cute child playing hopscotch -G1.0 -s100 -S -1
reusing previous seed 3498014304
[...]
outputs/img-samples/000040.3498014304.png: "a cute child playing hopscotch" -G1.0 -s100 -W512 -H512 -C7.5 -mk_lms -S3498014304
``` ```
--- ---
@ -73,66 +46,27 @@ This will tell the sampler to invest 25% of its effort on the tabby cat aspect o
on the white duck aspect (surprisingly, this example actually works). The prompt weights can use any on the white duck aspect (surprisingly, this example actually works). The prompt weights can use any
combination of integers and floating point numbers, and they do not need to add up to 1. combination of integers and floating point numbers, and they do not need to add up to 1.
---
## **Filename Format**
The argument `--fnformat` allows to specify the filename of the
image. Supported wildcards are all arguments what can be set such as
`perlin`, `seed`, `threshold`, `height`, `width`, `gfpgan_strength`,
`sampler_name`, `steps`, `model`, `upscale`, `prompt`, `cfg_scale`,
`prefix`.
The following prompt
```bash
dream> a red car --steps 25 -C 9.8 --perlin 0.1 --fnformat {prompt}_steps.{steps}_cfg.{cfg_scale}_perlin.{perlin}.png
```
generates a file with the name: `outputs/img-samples/a red car_steps.25_cfg.9.8_perlin.0.1.png`
---
## **Thresholding and Perlin Noise Initialization Options** ## **Thresholding and Perlin Noise Initialization Options**
Two new options are the thresholding (`--threshold`) and the perlin noise initialization (`--perlin`) options. Thresholding limits the range of the latent values during optimization, which helps combat oversaturation with higher CFG scale values. Perlin noise initialization starts with a percentage (a value ranging from 0 to 1) of perlin noise mixed into the initial noise. Both features allow for more variations and options in the course of generating images. Under the Noise section of the Web UI, you will find two options named
Perlin Noise and Noise Threshold. [Perlin
noise](https://en.wikipedia.org/wiki/Perlin_noise) is a type of
structured noise used to simulate terrain and other natural
textures. The slider controls the percentage of perlin noise that will
be mixed into the image at the beginning of generation. Adding a little
perlin noise to a generation will alter the image substantially.
The noise threshold limits the range of the latent values during
sampling and helps combat the oversharpening seem with higher CFG
scale values.
For better intuition into what these options do in practice: For better intuition into what these options do in practice:
![here is a graphic demonstrating them both](../assets/truncation_comparison.jpg) ![here is a graphic demonstrating them both](../assets/truncation_comparison.jpg)
In generating this graphic, perlin noise at initialization was programmatically varied going across on the diagram by values 0.0, 0.1, 0.2, 0.4, 0.5, 0.6, 0.8, 0.9, 1.0; and the threshold was varied going down from In generating this graphic, perlin noise at initialization was
0, 1, 2, 3, 4, 5, 10, 20, 100. The other options are fixed, so the initial prompt is as follows (no thresholding or perlin noise): programmatically varied going across on the diagram by values 0.0,
0.1, 0.2, 0.4, 0.5, 0.6, 0.8, 0.9, 1.0; and the threshold was varied
```bash going down from 0, 1, 2, 3, 4, 5, 10, 20, 100. The other options are
invoke> "a portrait of a beautiful young lady" -S 1950357039 -s 100 -C 20 -A k_euler_a --threshold 0 --perlin 0 fixed using the prompt "a portrait of a beautiful young lady" a CFG of
``` 20, 100 steps, and a seed of 1950357039.
Here's an example of another prompt used when setting the threshold to 5 and perlin noise to 0.2:
```bash
invoke> "a portrait of a beautiful young lady" -S 1950357039 -s 100 -C 20 -A k_euler_a --threshold 5 --perlin 0.2
```
!!! note
currently the thresholding feature is only implemented for the k-diffusion style samplers, and empirically appears to work best with `k_euler_a` and `k_dpm_2_a`. Using 0 disables thresholding. Using 0 for perlin noise disables using perlin noise for initialization. Finally, using 1 for perlin noise uses only perlin noise for initialization.
---
## **Simplified API**
For programmers who wish to incorporate stable-diffusion into other products, this repository
includes a simplified API for text to image generation, which lets you create images from a prompt
in just three lines of code:
```bash
from ldm.generate import Generate
g = Generate()
outputs = g.txt2img("a unicorn in manhattan")
```
Outputs is a list of lists in the format [filename1,seed1],[filename2,seed2]...].
Please see the documentation in ldm/generate.py for more information.
---

View File

@ -46,11 +46,19 @@ start the front end by selecting choice (3):
```sh ```sh
Do you want to generate images using the Do you want to generate images using the
1. command-line 1: Browser-based UI
2. browser-based UI 2: Command-line interface
3. textual inversion training 3: Run textual inversion training
4. open the developer console 4: Merge models (diffusers type only)
Please enter 1, 2, 3, or 4: [1] 3 5: Download and install models
6: Change InvokeAI startup options
7: Re-run the configure script to fix a broken install
8: Open the developer console
9: Update InvokeAI
10: Command-line help
Q: Quit
Please enter 1-10, Q: [1]
``` ```
From the command line, with the InvokeAI virtual environment active, From the command line, with the InvokeAI virtual environment active,

View File

@ -6,9 +6,7 @@ title: Variations
## Intro ## Intro
Release 1.13 of SD-Dream adds support for image variations. InvokeAI's support for variations enables you to do the following:
You are able to do the following:
1. Generate a series of systematic variations of an image, given a prompt. The 1. Generate a series of systematic variations of an image, given a prompt. The
amount of variation from one image to the next can be controlled. amount of variation from one image to the next can be controlled.
@ -30,19 +28,7 @@ The prompt we will use throughout is:
This will be indicated as `#!bash "prompt"` in the examples below. This will be indicated as `#!bash "prompt"` in the examples below.
First we let SD create a series of images in the usual way, in this case First we let SD create a series of images in the usual way, in this case
requesting six iterations: requesting six iterations.
```bash
invoke> lucy lawless as xena, warrior princess, character portrait, high resolution -n6
...
Outputs:
./outputs/Xena/000001.1579445059.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -S1579445059
./outputs/Xena/000001.1880768722.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -S1880768722
./outputs/Xena/000001.332057179.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -S332057179
./outputs/Xena/000001.2224800325.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -S2224800325
./outputs/Xena/000001.465250761.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -S465250761
./outputs/Xena/000001.3357757885.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -S3357757885
```
<figure markdown> <figure markdown>
![var1](../assets/variation_walkthru/000001.3357757885.png) ![var1](../assets/variation_walkthru/000001.3357757885.png)
@ -53,22 +39,16 @@ Outputs:
## Step 2 - Generating Variations ## Step 2 - Generating Variations
Let's try to generate some variations. Using the same seed, we pass the argument Let's try to generate some variations on this image. We select the "*"
`-v0.1` (or --variant_amount), which generates a series of variations each symbol in the line of icons above the image in order to fix the prompt
differing by a variation amount of 0.2. This number ranges from `0` to `1.0`, and seed. Then we open up the "Variations" section of the generation
with higher numbers being larger amounts of variation. panel and use the slider to set the variation amount to 0.2. The
higher this value, the more each generated image will differ from the
previous one.
```bash Now we run the prompt a second time, requesting six iterations. You
invoke> "prompt" -n6 -S3357757885 -v0.2 will see six images that are thematically related to each other. Try
... increasing and decreasing the variation amount and see what happens.
Outputs:
./outputs/Xena/000002.784039624.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 784039624:0.2 -S3357757885
./outputs/Xena/000002.3647897225.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 3647897225:0.2 -S3357757885
./outputs/Xena/000002.917731034.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 917731034:0.2 -S3357757885
./outputs/Xena/000002.4116285959.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 4116285959:0.2 -S3357757885
./outputs/Xena/000002.1614299449.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 1614299449:0.2 -S3357757885
./outputs/Xena/000002.1335553075.png: "prompt" -s50 -W512 -H512 -C7.5 -Ak_lms -V 1335553075:0.2 -S3357757885
```
### **Variation Sub Seeding** ### **Variation Sub Seeding**

View File

@ -773,7 +773,7 @@ class ModelManager(object):
""" """
model_path: Path = None model_path: Path = None
thing = path_url_or_repo # to save typing thing = str(path_url_or_repo) # to save typing
self.logger.info(f"Probing {thing} for import") self.logger.info(f"Probing {thing} for import")