diff --git a/Change-UI-Defaults.md b/Change-UI-Defaults.md new file mode 100644 index 0000000..daf1cc2 --- /dev/null +++ b/Change-UI-Defaults.md @@ -0,0 +1,16 @@ +The default values in the web UI can be changed by editing `ui-config.json`, which appears in the base directory containing `webui.py` after the first run. +The changes are only applied after restarting. +```json +{ + "txt2img/Sampling Steps/value": 20, + "txt2img/Sampling Steps/minimum": 1, + "txt2img/Sampling Steps/maximum": 150, + "txt2img/Sampling Steps/step": 1, + "txt2img/Batch count/value": 1, + "txt2img/Batch count/minimum": 1, + "txt2img/Batch count/maximum": 32, + "txt2img/Batch count/step": 1, + "txt2img/Batch size/value": 1, + "txt2img/Batch size/minimum": 1, + ... +``` diff --git a/Custom-scripts-from-users.md b/Custom-Scripts-from-Users.md similarity index 96% rename from Custom-scripts-from-users.md rename to Custom-Scripts-from-Users.md index 4e99678..90d6cd5 100644 --- a/Custom-scripts-from-users.md +++ b/Custom-Scripts-from-Users.md @@ -1,6 +1,6 @@ To install custom scripts, drop them into `scripts` directory and restart the web ui. -## Advanced prompt matrix +# Advanced prompt matrix https://github.com/GRMrGecko/stable-diffusion-webui-automatic/blob/advanced_matrix/scripts/advanced_prompt_matrix.py It allows a matrix prompt as follows: @@ -8,7 +8,7 @@ It allows a matrix prompt as follows: Does not actually draw a matrix, just produces pictures. -## Wildcards +# Wildcards https://github.com/jtkelm2/stable-diffusion-webui-1/blob/master/scripts/wildcards.py Script support so that prompts can contain wildcard terms (indicated by surrounding double underscores), with values instantiated randomly from the corresponding .txt file in the folder `/scripts/wildcards/`. For example: diff --git a/Dependencies.md b/Dependencies.md new file mode 100644 index 0000000..5de7b69 --- /dev/null +++ b/Dependencies.md @@ -0,0 +1,35 @@ +# Required Dependencies +1. Python 3.10.6 and Git: + - Windows: + - [Python](https://www.python.org/downloads/windows/) + - [Git](https://git-scm.com) + - Linux (Debian-based): + ```bash + sudo apt install wget git python3 python3-venv + ``` + - Linux (Red Hat-based): + ```bash + sudo dnf install wget git python3 + ``` + - Linux (Arch-based): + ```bash + sudo pacman -S wget git python3 + ``` +2. The stable-diffusion-webui code may be cloned by running: + ```bash + git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git + ``` +3. The Stable Diffusion model checkpoint `model.ckpt` needs to be placed in the base directory, alongside `webui.py` + - [Official download](https://huggingface.co/CompVis/stable-diffusion-v-1-4-original) + - [File storage](https://drive.yerf.org/wl/?id=EBfTrmcCCUAGaQBXVIj5lJmEhjoP1tgl) + - Torrent (magnet:?xt=urn:btih:3a4a612d75ed088ea542acac52f9f45987488d1c&dn=sd-v1-4.ckpt&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337) + +# Optional Dependencies +## GFPGAN (Improve Faces) +GFPGAN can be used to improve faces, requiring the [model](https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth) to be placed in the base directory. + +## ESRGAN (Upscaling) +ESRGAN models such as those from the [Model Database](https://upscale.wiki/wiki/Model_Database, may be placed into the ESRGAN directory. +A file will be loaded as a model if it has `.pth` extension, and it will show up with its name in the UI. + +> Note: RealESRGAN models are not ESRGAN models, they are not compatible. Do not download RealESRGAN models. Do not place RealESRGAN into the directory with ESRGAN models. diff --git a/Features.md b/Features.md new file mode 100644 index 0000000..a16ceb6 --- /dev/null +++ b/Features.md @@ -0,0 +1,347 @@ +This is a feature showcase page for [Stable Diffusion web UI](https://github.com/AUTOMATIC1111/stable-diffusion-webui). + +All examples are non-cherrypicked unless specified otherwise. + +# Outpainting + +Outpainting extends original image and inpaints created empty space. + +Example: + +| Original | Oupainting | Outpainting again | +|------------------------------|------------------------------|------------------------------| +| ![](images/outpainting-1.png) | ![](images/outpainting-2.png) | ![](images/outpainting-3.png) | + +Original image by Anonymous user from 4chan. Thank you, Anonymous user. + +You can find the feature in the img2img tab at the bottom, under Script -> Poor man's outpainting. + +Outpainting, unlike normal image generation, seems to profit very much from large step count. A recipe for a good outpainting +is a good prompt that matches the picture, sliders for denoising and FCG scale set to max, and step count of 50 to 100 with +euler ancestral or DPM2 ancestral samplers. + +| 81 steps, Euler A | 30 steps, Euler A | 10 steps, Euler A | 80 steps, Euler A | +|-------------------------------------|---------------------------------------|--------------------------------------|-------------------------------------| +| ![](images/inpainting-81-euler-a.png) | ![](images/inpainting-30-euler-a.png) | ![](images/inpainting-10-euler-a.png) | ![](images/inpainting-80-dpm2-a.png) | + +# Inpainting +In img2img tab, draw a mask over a part of image, and that part will be in-painted. + +![](images/inpainting.png) + +Options for inpainting: +- draw a mask yourself in web editor +- erase a part of picture in external editor and upload a transparent picture. Any even slightly transparent areas will become part of the mask. Be aware that [some editors](https://docs.krita.org/en/reference_manual/layers_and_masks/split_alpha.html#how-to-save-a-png-texture-and-keep-color-values-in-fully-transparent-areas) save completely transparent areas as black by default. +- change mode (to the bottom right of the picture) to "Upload mask" and choose a separate black and while image for mask (white=inpaint). + +## Masked content +Masked content field determines content is placed to put into the masked regions before thet are inpainted. + +| mask | fill | original | latent noise | latent nothing | +|-------------------------------------------------|-------------------------------------------------|-----------------------------------------------------|---------------------------------------------------------|-----------------------------------------------------------| +| ![](images/inpainting-initial-content-mask.png) | ![](images/inpainting-initial-content-fill.png) | ![](images/inpainting-initial-content-original.png) | ![](images/inpainting-initial-content-latent-noise.png) | ![](images/inpainting-initial-content-latent-nothing.png) | + +## Inpaint at full resolution +Normally, inpaiting resizes the image to target resolution specified in the UI. With Inpaint at full resolution +enabled, only the masked region is resized, and after processing it is pasted back to the original picture. +This allows you to work with large pictures, and allows to render the inpained object at a much larger resolution. + + +| Input | Inpaint normal | Inpaint at whole resolution | +|-------------------------------------|----------------------------------|-----------------------------------| +| ![](images/inpaint-whole-mask.png) | ![](images/inpaint-whole-no.png) | ![](images/inpaint-whole-yes.png) | + + +## Masking mode +There are two options for masked mode: +- Inpaint masked - the region under the mask is inpainted +- Inpaint not masked - under the mask is unchanged, everything else is inpainted + +## Alpha mask + +| Input | Output | +|------------------------------|-------------------------------| +| ![](images/inpaint-mask.png) | ![](images/inpaint-mask2.png) | + + +# Prompt matrix +Separate multiple prompts using the `|` character, and the system will produce an image for every combination of them. +For example, if you use `a busy city street in a modern city|illustration|cinematic lighting` prompt, there are four combinations possible (first part of prompt is always kept): + +- `a busy city street in a modern city` +- `a busy city street in a modern city, illustration` +- `a busy city street in a modern city, cinematic lighting` +- `a busy city street in a modern city, illustration, cinematic lighting` + +Four images will be produced, in this order, all with same seed and each with corresponding prompt: +![](images/prompt-matrix.png) + +Another example, this time with 5 prompts and 16 variations: +![](images/prompt_matrix.jpg) + +You can find the feature at the bottom, under Script -> Prompt matrix. + +# Stable Diffusion upscale +Upscale image using RealESRGAN/ESRGAN and then go through tiles of the result, improving them with img2img. +Also has an let you do the upscaling part yourself in external program, and just go through tiles with img2img. + +Original idea by: https://github.com/jquesnelle/txt2imghd. This is an independent implementation. + +To use this feature, tick a checkbox in the img2img interface. Input image will be upscaled to twice the original +width and height, and UI's width and height sliders specify the size of individual tiles. Because of overlap, +the size of tile can be very important: 512x512 image needs nine 512x512 tiles (because of overlap), but only +four 640x640 tiles. + +Rcommended parameters for upscaling: + - Sampling method: Euler a + - Denoising strength: 0.2, can go up to 0.4 if you feel adventureous + +| Original | RealESRGAN | Topaz Gigapixel | SD upscale | +|-------------------------------------------|---------------------------------------------|---------------------------------------------------------|---------------------------------------------| +| ![](images/sd-upscale-robot-original.png) | ![](images/sd-upscale-robot-realesrgan.png) | ![](images/sd-upscale-robot-esrgan-topaz-gigapixel.png) | ![](images/sd-upscale-robot-sd-upscale.png) | +| ![](images/sd-upscale-castle-original.png) | ![](images/sd-upscale-castle-realesrgan.png) | ![](images/sd-upscale-castle-esrgan-topaz-gigapixel.png) | ![](images/sd-upscale-castle-sd-upscale.png) | +| ![](images/sd-upscale-city-original.png) | ![](images/sd-upscale-city-realesrgan.png) | ![](images/sd-upscale-city-esrgan-topaz-gigapixel.png) | ![](images/sd-upscale-city-sd-upscale.png) | + +# Attention +Using `()` in prompt increases model's attention to enclosed words, and `[]` decreases it. You can combine +multiple modifiers: + +![](images/attention-3.jpg) + +# Loopback +A checkbox for img2img allowing to automatically feed output image as input for the next batch. Equivalent to +saving output image, and replacing input image with it. Batch count setting controls how many iterations of +this you get. + +Usually, when doing this, you would choose one of many images for the next iteration yourself, so the usefulness +of this feature may be questionable, but I've managed to get some very nice outputs with it that I wasn't abble +to get otherwise. + +Example: (cherrypicked result) + +![](images/loopback.jpg) + +Original image by Anonymous user from 4chan. Thank you, Anonymous user. + +# X/Y plot +Creates a grid of images with varying parameters. Select which parameters should be shared by rows and columns using +X type and Y type fields, and input those parameters separated by comma into X values/Y values fields. For integer, +and floating ponit numbers, ranges are supported. Examples: + +- `1-5` = 1, 2, 3, 4, 5 +- `1-5 (+2)` = 1, 3, 5 +- `10-5 (-3)` = 10, 7 +- `1-3 (+0.5)` = 1, 1.5, 2, 2.5, 3 + +![](images/xy_grid-medusa.png) + +Here's are settings that create the graph above: + +![](images/xy_grid-medusa-ui.png) + +# Textual Inversion +Allows you to use pretrained textual inversion embeddings. +See original site for details: https://textual-inversion.github.io/. +I used lstein's repo for training embdedding: https://github.com/lstein/stable-diffusion; if +you want to train your own, I recommend following the guide on his site. + +To make use of pretrained embeddings, create `embeddings` directory in the root dir of Stable +Diffusion and put your embeddings into it. They must be .pt files about 5Kb in size, each with only +one trained embedding, and the filename (without .pt) will be the term you'd use in prompt +to get that embedding. + +As an example, I trained one for about 5000 steps: https://files.catbox.moe/e2ui6r.pt; it does +not produce very good results, but it does work. Download and rename it to `Usada Pekora.pt`, +and put it into `embeddings` dir and use Usada Pekora in prompt. + +![](images/inversion.png) + +# Resizing +There are three options for resizing input images in img2img mode: + +- Just resize - simply resizes source image to target resolution, resulting in incorrect aspect ratio +- Crop and resize - resize source image preserving aspect ratio so that entirety of target resolution is occupied by it, and crop parts that stick out +- Resize and fill - resize source image preserving aspect ratio so that it entirely fits target resolution, and fill empty space by rows/columns from source image + +Example: +![](images/resizing.jpg) + +# Sampling method selection +Pick out of multiple sampling methods for txt2img: + +![](images/sampling.jpg) + +# Seed resize +This function allows you to generate images from known seeds at different resolutions. Normally, when you change resolution, +the image changes entirely, even if you keep all other parameters including seed. With seed resizing you specify the resolution +of the original image, and the model will very likely produce something looking very similar to it, even at a different resolution. +In the example below, the leftmost picture is 512x512, and others are produced with exact same parameters but with larger vertical +resolution. + +| Info | Image | +|---------------------------|-------------------------------| +| Seed resize not enabled | ![](images/seed-noresize.png) | +| Seed resized from 512x512 | ![](images/seed-resize.png) | + +Ancestral samplers are a little worse at this than the rest. + +You can find this ferature by clicking the "Extra" checkbox near the seed. + +# Variations +A Variation strength slider and Variation seed field allow you to specify how much the existing picture should be altered to look +like a different one. At maximum strength you will get picture with Variation seed, at minimum - picture with original Seed (except +for when using ancestral samplers). + +![](images/seed-variations.jpg) + +You can find this ferature by clicking the "Extra" checkbox near the seed. + +# Styles +Press "Save prompt as style" button to write your current prompt to styles.csv, the file with collection of styles. A dropbox to +the right of the prompt will allow you to choose any style out of previously saved, and automatically append it to your input. +To delete style, manually delete it from styles.csv and restart the program. + +# Negative prompt + +Allows you to use another prompt of things the model should avoid when generating the picture. This works by using the +negative prompt for unconditional conditioning in the sampling process instead of empty string. + +| Original | Negative: purple | Negative: tentacles | +|-------------------------------|---------------------------------|------------------------------------| +| ![](images/negative-base.png) | ![](images/negative-purple.png) | ![](images/negative-tentacles.png) | + +# CLIP interrogator + +Originally by: https://github.com/pharmapsychotic/clip-interrogator + +CLIP interrogator allows you to retrieve prompt from an image. The prompt won't allow you to reproduce this +exact image (and sometimes it won't even be close), but it can be a good start. + +![](images/CLIP-interrogate.png) + +The first time you run CLIP interrogator it will download few gigabytes of models. + +CLIP interrogator has two parts: one is a BLIP model that creates a text description from the picture. +Other is a CLIP model that will pick few lines relevant to the picture out of a list. By default, there +is only one list - a list of artists (from `artists.csv`). You can add more lists by doing the follwoing: + + - create `interrogate` directory in same place as web ui + - put text files in it with a relevant description on each line + +For example of what text files to use, see https://github.com/pharmapsychotic/clip-interrogator/tree/main/data. +In fact, you can just take files from there and use them - just skip artists.txt because you already have a list of +artists in `artists.csv` (or use that too, who's going to stop you). Each file adds one line of text to final description. +If you add ".top3." to filename, for example, `flavors.top3.txt`, three most relevant lines from this file will be +added to the prompt (other numbers also work). + +There are settings relevant to this feature: + - `Interrogate: keep models in VRAM` - do not unload Interrogate models from memory after using them. For users with a lot of VRAM. + - `Interrogate: use artists from artists.csv` - adds artist from `artists.csv` when interrogating. Can be useful disable when you have your list of artists in `interrogate` directory + - `Interrogate: num_beams for BLIP` - parameter that affects how detailed descriptions from BLIP model are (the first part of generated prompt) + - `Interrogate: minimum descripton length` - minimum length for BLIP model's text + - `Interrogate: maximum descripton length` - maximum length for BLIP model's text + - `Interrogate: maximum number of lines in text file` - interrogator will only consider this many first lines in a file. Set to 0, default is 1500, which is about as much as a 4GB videocard can handle. + +# Interrupt + +Press the Interrupt button to stop current processing. + +# 4GB videocard support +Optimizations for GPUs with low VRAM. This should make it possible to generate 512x512 images on videocards with 4GB memory. + +`--lowvram` is a reimplementation of optimization idea from by [basujindal](https://github.com/basujindal/stable-diffusion). +Model is separated into modules, and only one module is kept in GPU memory; when another module needs to run, the previous +is removed from GPU memory. The nature of this optimization makes the processing run slower -- about 10 times slower +compared to normal operation on my RTX 3090. + +`--medvram` is another optimization that should reduce VRAM usage significantly by not processing conditional and +unconditional denoising in a same batch. + +This implementation of optimization does not require any modification to original Stable Diffusion code. + +# Face restoration +Lets you improve faces in pictures using either GFPGAN or CodeFormer. There is a checkbox in every tab to use face restoration, +and also a separate tab that just allows you to use face restoration on any picture, with a slider that controls how visible +the effect is. You can choose between the two methods in settings. + +| Original | GFPGAN | CodeFormer | +|-------------------------|--------------------------------|------------------------------------| +| ![](images/facefix.png) | ![](images/facefix-gfpgan.png) | ![](images/facefix-codeformer.png) | + + +# Saving +Click the Save button under the output section, and generated images will be saved to a directory specified in settings; +generation parameters will be appended to a csv file in the same directory. + +# Correct seeds for batches +If you use a seed of 1000 to generate two batches of two images each, four generated images will have seeds: `1000, 1001, 1002, 1003`. +Previous versions of the UI would produce `1000, x, 1001, x`, where x is an image that can't be generated by any seed. + +# Loading +Gradio's loading graphic has a very negative effect on the processing speed of the neural network. +My RTX 3090 makes images about 10% faster when the tab with gradio is not active. By default, the UI +now hides loading progress animation and replaces it with static "Loading..." text, which achieves +the same effect. Use the `--no-progressbar-hiding` commandline option to revert this and show loading animations. + +# Prompt validation +Stable Diffusion has a limit for input text length. If your prompt is too long, you will get a +warning in the text output field, showing which parts of your text were truncated and ignored by the model. + +# Png info +Adds information about generation parameters to PNG as a text chunk. You +can view this information later using any software that supports viewing +PNG chunk info, for example: https://www.nayuki.io/page/png-file-chunk-inspector + +# Settings +A tab with settings, allowing you to use UI to edit more than half of parameters that previously +were commandline. Settings are saved to config.js file. Settings that remain as commandline +options are ones that are required at startup. + +# User scripts +If the program is launched with `--allow-code` option, an extra text input field for script code +is available in the bottom of the page, under Scripts -> Custom code. It allows you to input python +code that will do the work with the image. + +In code, access parameters from web UI using the `p` variable, and provide outputs for web UI +using the `display(images, seed, info)` function. All globals from script are also accessible. + +A simple script that would just process the image and output it normally: + +```python +import modules.processing + +processed = modules.processing.process_images(p) + +print("Seed was: " + str(processed.seed)) + +display(processed.images, processed.seed, processed.info) +``` + +# UI config +You can change parameters for UI elements: + - radio groups: default selection + - sliders: defaul value, min, max, step + +The file is ui-config.json in webui dir, and it is created automatically if you don't have one when the program starts. + +Some settings will break processing, like step not divisible by 64 for width and heght, and some, lie changing default +function on the img2img tab, may break UI. I do not have plans to address those in near future. + +# ESRGAN +It's possible to use ESRGAN models on the Extras tab, as well as in SD upscale. + +To use ESRGAN models, put them into ESRGAN directory in the same location as webui.py. +A file will be loaded as model if it has .pth extension. Grab models from the [Model Database](https://upscale.wiki/wiki/Model_Database). + +Not all models from the database are supported. All 2x models are most likely not supported. + +# img2img alternative test +- see [this post](https://www.reddit.com/r/StableDiffusion/comments/xboy90/a_better_way_of_doing_img2img_by_finding_the/) on ebaumsworld.com for context. +- find it in scripts section +- put description of input image into the Original prompt field +- use Euler only +- recommended: 50 steps, low cfg scale between 1 and 2 +- denoising and seed don't matter +- decode cfg scale between 0 and 1 +- decode steps 50 +- original blue haired woman close nearly reproduces with cfg scale=1.8 diff --git a/Home.md b/Home.md index e7091d1..3dc63f5 100644 --- a/Home.md +++ b/Home.md @@ -1 +1,10 @@ -Welcome to the stable-diffusion-webui wiki! +**Stable Diffusion web UI** is a browser interface for Stable Diffusion based on Gradio library. + +- [Features](Features) +- [Dependencies](Dependencies) +- [Installation and run on NVidia GPUs](Install-and-Run-on-NVidia-GPUs) +- [Installation and run on AMD GPUs](Install-and-Run-on-AMD-GPUs) +- [Running with custom parameters](Run-with-Custom-Parameters) +- [Changing UI defaults](Change-UI-Defaults) +- [Custom scripts from users](Custom-Scripts-from-Users) +- [Troubleshooting](Troubleshooting) diff --git a/Running-using-AMD-GPUs.md b/Install-and-Run-on-AMD-GPUs.md similarity index 100% rename from Running-using-AMD-GPUs.md rename to Install-and-Run-on-AMD-GPUs.md diff --git a/Install-and-Run-on-NVidia-GPUs.md b/Install-and-Run-on-NVidia-GPUs.md new file mode 100644 index 0000000..85d438f --- /dev/null +++ b/Install-and-Run-on-NVidia-GPUs.md @@ -0,0 +1,114 @@ +Before attempting to install make sure all the required [dependencies](Dependencies) are met. + +# Automatic Installation +## Windows +Run `webui-user.bat` from Windows Explorer as normal, ***non-administrate***, user. + +## Linux +To install in the default directory `/home/$(whoami)/stable-diffusion-webui/`, run: +```bash +bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh) +``` + +In order to customize the installation, clone the repository into the desired location, change the required variables in `webui-user.sh` and run : +```bash +bash webui.sh +``` + +# Almost Automatic Installation and Launch +To install the required packages via pip without creating a virtual environment, run: +```bash +python launch.py +``` + +Command line arguments may be passed directly, for example: +```bash +python launch.py --opt-split-attention --ckpt ../secret/anime9999.ckpt +``` + +# Manual Installation +The following process installs everything manually on both Windows or Linux (the latter requiring `dir` to be replaced by `ls`): +```bash +# install torch with CUDA support. See https://pytorch.org/get-started/locally/ for more instructions if this fails. +pip install torch --extra-index-url https://download.pytorch.org/whl/cu113 + +# check if torch supports GPU; this must output "True". You need CUDA 11. installed for this. You might be able to use +# a different version, but this is what I tested. +python -c "import torch; print(torch.cuda.is_available())" + +# clone web ui and go into its directory +git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git +cd stable-diffusion-webui + +# clone repositories for Stable Diffusion and (optionally) CodeFormer +mkdir repositories +git clone https://github.com/CompVis/stable-diffusion.git repositories/stable-diffusion +git clone https://github.com/CompVis/taming-transformers.git repositories/taming-transformers +git clone https://github.com/sczhou/CodeFormer.git repositories/CodeFormer +git clone https://github.com/salesforce/BLIP.git repositories/BLIP + +# install requirements of Stable Diffusion +pip install transformers==4.19.2 diffusers invisible-watermark --prefer-binary + +# install k-diffusion +pip install git+https://github.com/crowsonkb/k-diffusion.git --prefer-binary + +# (optional) install GFPGAN (face restoration) +pip install git+https://github.com/TencentARC/GFPGAN.git --prefer-binary + +# (optional) install requirements for CodeFormer (face restoration) +pip install -r repositories/CodeFormer/requirements.txt --prefer-binary + +# install requirements of web ui +pip install -r requirements.txt --prefer-binary + +# update numpy to latest version +pip install -U numpy --prefer-binary + +# (outside of command line) put stable diffusion model into web ui directory +# the command below must output something like: 1 File(s) 4,265,380,512 bytes +dir model.ckpt + +# (outside of command line) put the GFPGAN model into web ui directory +# the command below must output something like: 1 File(s) 348,632,874 bytes +dir GFPGANv1.3.pth +``` + +The installation is finished, to start the web ui, run: +```bash +python webui.py +``` + +# Windows 11 WSL2 instructions +To install under a Linux distro in Windows 11's WSL2: +```bash +# install conda (if not already done) +wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh +chmod +x Anaconda3-2022.05-Linux-x86_64.sh +./Anaconda3-2022.05-Linux-x86_64.sh + +# Clone webui repo +git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git +cd stable-diffusion-webui + +# Create and activate conda env +conda env create -f environment-wsl2.yaml +conda activate automatic + +# (optional) install requirements for GFPGAN (upscaling) +wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth +``` + +At this point, the instructions for the Manual installation may be applied starting at step `# clone repositories for Stable Diffusion and (optionally) CodeFormer`. + +# Troubleshooting +- Although support will only be offered for Python 3.10.6, other versions should work. +- The installer creates a python virtual environment, so none of the installed modules will affect existing system installations of python. +- To use the system's python rather than creating a virtual environment, use custom parameter replacing `set VENV_DIR=-`. +- To reinstall from scratch, delete directories: `venv`, `repositories`. + +## Windows +- If the desired version of Python is not in PATH, modify the line `set PYTHON=python` in `webui-user.bat` with the full path to the python executable. + - Example: `set PYTHON=B:\soft\Python310\python.exe` + - This won't work with git. +- `webui.bat` installs requirements from `requirements_versions.txt`, which lists versions for modules specifically compatible with Python 3.10.6. If this doesn't work with other versions of Python, setting the custom parameter `set REQS_FILE=requirements.txt` may help. diff --git a/Run-with-Custom-Parameters.md b/Run-with-Custom-Parameters.md new file mode 100644 index 0000000..6a70ee8 --- /dev/null +++ b/Run-with-Custom-Parameters.md @@ -0,0 +1,19 @@ +# webui-user +The recommended way to customize how the program is run is editing `webui-user.bat` (Windows) and `webui-user.sh` (Linux): +- `set PYTHON` allows for setting a custom Python path + - Example: `set PYTHON=b:/soft/Python310/Python.exe` +- `set VENV_DIR` allows for setting a custom virtual environment: + - Example: `set VENV_DIR=-` runs the program using the system's python +- `set COMMANDLINE_ARGS` setting the command line arguments `webui.py` is ran with + - Example: `set COMMANDLINE_ARGS=--ckpt a.ckpt` uses the model `a.ckpt` instead of `model.ckpt` + +# Command Line Arguments +## Creating Large Images +Use `--opt-split-attention` parameter. It slows down sampling a tiny bit, but allows you to make gigantic images. + +## Running online +Use the `--share` option to run online. You will get a xxx.app.gradio link. This is the intended way to use the program in collabs. You may set up authentication for said gradio shared instance with the flag `--gradio-auth username:password`, optionally providing multiple sets of usernames and passwords separated by commas. + +Use `--listen` to make the server listen to network connections. This will allow computers on the local network to access the UI, and if you configure port forwarding, also computers on the internet. + +Use `--port xxxx` to make the server listen on a specific port, xxxx being the wanted port. Remember that all ports below 1024 need root/admin rights, for this reason it is advised to use a port above 1024. Defaults to port 7860 if available. diff --git a/Troubleshooting.md b/Troubleshooting.md new file mode 100644 index 0000000..3cb4caf --- /dev/null +++ b/Troubleshooting.md @@ -0,0 +1,14 @@ +# Low VRAM Video-cards +When running on video cards with a low amount of VRAM (<=4GB), out of memory errors may arise. +Various optimizations may be enabled through command line arguments, sacrificing some/a lot of speed in favor of using less VRAM: +- If you have 4GB VRAM and want to make 512x512 (or maybe up to 640x640) images, use `--medvram`. +- If you have 4GB VRAM and want to make 512x512 images, but you get an out of memory error with `--medvram`, use `--medvram --opt-split-attention` instead. +- If you have 4GB VRAM and want to make 512x512 images, and you still get an out of memory error, use `--lowvram --always-batch-cond-uncond --opt-split-attention` instead. +- If you have 4GB VRAM and want to make images larger than you can with `--medvram`, use `--lowvram --opt-split-attention`. +- If you have more VRAM and want to make larger images than you can usually make (for example 1024x1024 instead of 512x512), use `--medvram --opt-split-attention`. You can use `--lowvram` also but the effect will likely be barely noticeable. +- Otherwise, do not use any of those. + +# Green or Black screen +Video cards +When running on video cards which don't support half precision floating point numbers (a known issue with 16xx cards), a green or black screen may appear instead of the generated pictures. +This may be fixed by using the command line arguments `--precision full --no-half` at a significant increase in VRAM usage, which may require `--medvram`. diff --git a/_Footer.md b/_Footer.md new file mode 100644 index 0000000..b4931b6 --- /dev/null +++ b/_Footer.md @@ -0,0 +1 @@ +This is the _Stable Diffusion web UI_ wiki. [Wiki Home](https://github.com/neovim/neovim/wiki) diff --git a/images/CLIP-interrogate.png b/images/CLIP-interrogate.png new file mode 100644 index 0000000..7c7c66f Binary files /dev/null and b/images/CLIP-interrogate.png differ diff --git a/images/GFPGAN.png b/images/GFPGAN.png new file mode 100644 index 0000000..bd42c01 Binary files /dev/null and b/images/GFPGAN.png differ diff --git a/images/attention-3.jpg b/images/attention-3.jpg new file mode 100644 index 0000000..7c7ef0d Binary files /dev/null and b/images/attention-3.jpg differ diff --git a/images/facefix-codeformer.png b/images/facefix-codeformer.png new file mode 100644 index 0000000..6fcad5c Binary files /dev/null and b/images/facefix-codeformer.png differ diff --git a/images/facefix-gfpgan.png b/images/facefix-gfpgan.png new file mode 100644 index 0000000..530b555 Binary files /dev/null and b/images/facefix-gfpgan.png differ diff --git a/images/facefix.png b/images/facefix.png new file mode 100644 index 0000000..0514be9 Binary files /dev/null and b/images/facefix.png differ diff --git a/images/inpaint-mask.png b/images/inpaint-mask.png new file mode 100644 index 0000000..169d724 Binary files /dev/null and b/images/inpaint-mask.png differ diff --git a/images/inpaint-mask2.png b/images/inpaint-mask2.png new file mode 100644 index 0000000..d4979d2 Binary files /dev/null and b/images/inpaint-mask2.png differ diff --git a/images/inpaint-whole-mask.png b/images/inpaint-whole-mask.png new file mode 100644 index 0000000..8172479 Binary files /dev/null and b/images/inpaint-whole-mask.png differ diff --git a/images/inpaint-whole-no.png b/images/inpaint-whole-no.png new file mode 100644 index 0000000..b2b81a8 Binary files /dev/null and b/images/inpaint-whole-no.png differ diff --git a/images/inpaint-whole-yes.png b/images/inpaint-whole-yes.png new file mode 100644 index 0000000..675d6cf Binary files /dev/null and b/images/inpaint-whole-yes.png differ diff --git a/images/inpainting-10-euler-a.png b/images/inpainting-10-euler-a.png new file mode 100644 index 0000000..5768454 Binary files /dev/null and b/images/inpainting-10-euler-a.png differ diff --git a/images/inpainting-30-euler-a.png b/images/inpainting-30-euler-a.png new file mode 100644 index 0000000..c23550a Binary files /dev/null and b/images/inpainting-30-euler-a.png differ diff --git a/images/inpainting-80-dpm2-a.png b/images/inpainting-80-dpm2-a.png new file mode 100644 index 0000000..5b94e3e Binary files /dev/null and b/images/inpainting-80-dpm2-a.png differ diff --git a/images/inpainting-81-euler-a.png b/images/inpainting-81-euler-a.png new file mode 100644 index 0000000..53faa01 Binary files /dev/null and b/images/inpainting-81-euler-a.png differ diff --git a/images/inpainting-initial-content-fill.png b/images/inpainting-initial-content-fill.png new file mode 100644 index 0000000..0ea6537 Binary files /dev/null and b/images/inpainting-initial-content-fill.png differ diff --git a/images/inpainting-initial-content-latent-noise.png b/images/inpainting-initial-content-latent-noise.png new file mode 100644 index 0000000..ea8ae24 Binary files /dev/null and b/images/inpainting-initial-content-latent-noise.png differ diff --git a/images/inpainting-initial-content-latent-nothing.png b/images/inpainting-initial-content-latent-nothing.png new file mode 100644 index 0000000..be781a3 Binary files /dev/null and b/images/inpainting-initial-content-latent-nothing.png differ diff --git a/images/inpainting-initial-content-mask.png b/images/inpainting-initial-content-mask.png new file mode 100644 index 0000000..c86ac41 Binary files /dev/null and b/images/inpainting-initial-content-mask.png differ diff --git a/images/inpainting-initial-content-original.png b/images/inpainting-initial-content-original.png new file mode 100644 index 0000000..a62c6be Binary files /dev/null and b/images/inpainting-initial-content-original.png differ diff --git a/images/inpainting.png b/images/inpainting.png new file mode 100644 index 0000000..93f71d2 Binary files /dev/null and b/images/inpainting.png differ diff --git a/images/inversion.png b/images/inversion.png new file mode 100644 index 0000000..4105de5 Binary files /dev/null and b/images/inversion.png differ diff --git a/images/loopback.jpg b/images/loopback.jpg new file mode 100644 index 0000000..39602eb Binary files /dev/null and b/images/loopback.jpg differ diff --git a/images/negative-base.png b/images/negative-base.png new file mode 100644 index 0000000..3066e84 Binary files /dev/null and b/images/negative-base.png differ diff --git a/images/negative-purple.png b/images/negative-purple.png new file mode 100644 index 0000000..84430a2 Binary files /dev/null and b/images/negative-purple.png differ diff --git a/images/negative-tentacles.png b/images/negative-tentacles.png new file mode 100644 index 0000000..42e5d82 Binary files /dev/null and b/images/negative-tentacles.png differ diff --git a/images/outpainting-1.png b/images/outpainting-1.png new file mode 100644 index 0000000..b02e4e8 Binary files /dev/null and b/images/outpainting-1.png differ diff --git a/images/outpainting-2.png b/images/outpainting-2.png new file mode 100644 index 0000000..55b314b Binary files /dev/null and b/images/outpainting-2.png differ diff --git a/images/outpainting-3.png b/images/outpainting-3.png new file mode 100644 index 0000000..e9d7999 Binary files /dev/null and b/images/outpainting-3.png differ diff --git a/images/prompt-matrix.png b/images/prompt-matrix.png new file mode 100644 index 0000000..9979133 Binary files /dev/null and b/images/prompt-matrix.png differ diff --git a/images/prompt_matrix.jpg b/images/prompt_matrix.jpg new file mode 100644 index 0000000..570c8c0 Binary files /dev/null and b/images/prompt_matrix.jpg differ diff --git a/images/resizing.jpg b/images/resizing.jpg new file mode 100644 index 0000000..6ac344c Binary files /dev/null and b/images/resizing.jpg differ diff --git a/images/sampling.jpg b/images/sampling.jpg new file mode 100644 index 0000000..fbff1cf Binary files /dev/null and b/images/sampling.jpg differ diff --git a/images/sd-upscale-castle-esrgan-topaz-gigapixel.png b/images/sd-upscale-castle-esrgan-topaz-gigapixel.png new file mode 100644 index 0000000..a5cc0c4 Binary files /dev/null and b/images/sd-upscale-castle-esrgan-topaz-gigapixel.png differ diff --git a/images/sd-upscale-castle-original.png b/images/sd-upscale-castle-original.png new file mode 100644 index 0000000..9862284 Binary files /dev/null and b/images/sd-upscale-castle-original.png differ diff --git a/images/sd-upscale-castle-realesrgan.png b/images/sd-upscale-castle-realesrgan.png new file mode 100644 index 0000000..0411527 Binary files /dev/null and b/images/sd-upscale-castle-realesrgan.png differ diff --git a/images/sd-upscale-castle-sd-upscale.png b/images/sd-upscale-castle-sd-upscale.png new file mode 100644 index 0000000..7eaa1aa Binary files /dev/null and b/images/sd-upscale-castle-sd-upscale.png differ diff --git a/images/sd-upscale-city-esrgan-topaz-gigapixel.png b/images/sd-upscale-city-esrgan-topaz-gigapixel.png new file mode 100644 index 0000000..c483ce6 Binary files /dev/null and b/images/sd-upscale-city-esrgan-topaz-gigapixel.png differ diff --git a/images/sd-upscale-city-original.png b/images/sd-upscale-city-original.png new file mode 100644 index 0000000..8a57a19 Binary files /dev/null and b/images/sd-upscale-city-original.png differ diff --git a/images/sd-upscale-city-realesrgan.png b/images/sd-upscale-city-realesrgan.png new file mode 100644 index 0000000..c38fe24 Binary files /dev/null and b/images/sd-upscale-city-realesrgan.png differ diff --git a/images/sd-upscale-city-sd-upscale.png b/images/sd-upscale-city-sd-upscale.png new file mode 100644 index 0000000..3446a1f Binary files /dev/null and b/images/sd-upscale-city-sd-upscale.png differ diff --git a/images/sd-upscale-robot-esrgan-topaz-gigapixel.png b/images/sd-upscale-robot-esrgan-topaz-gigapixel.png new file mode 100644 index 0000000..ffbd5b9 Binary files /dev/null and b/images/sd-upscale-robot-esrgan-topaz-gigapixel.png differ diff --git a/images/sd-upscale-robot-original.png b/images/sd-upscale-robot-original.png new file mode 100644 index 0000000..c567993 Binary files /dev/null and b/images/sd-upscale-robot-original.png differ diff --git a/images/sd-upscale-robot-realesrgan.png b/images/sd-upscale-robot-realesrgan.png new file mode 100644 index 0000000..602ba37 Binary files /dev/null and b/images/sd-upscale-robot-realesrgan.png differ diff --git a/images/sd-upscale-robot-sd-upscale.png b/images/sd-upscale-robot-sd-upscale.png new file mode 100644 index 0000000..ea61303 Binary files /dev/null and b/images/sd-upscale-robot-sd-upscale.png differ diff --git a/images/seed-noresize.png b/images/seed-noresize.png new file mode 100644 index 0000000..123882b Binary files /dev/null and b/images/seed-noresize.png differ diff --git a/images/seed-resize.png b/images/seed-resize.png new file mode 100644 index 0000000..c7928c7 Binary files /dev/null and b/images/seed-resize.png differ diff --git a/images/seed-variations.jpg b/images/seed-variations.jpg new file mode 100644 index 0000000..a227e3c Binary files /dev/null and b/images/seed-variations.jpg differ diff --git a/images/xy_grid-medusa-ui.png b/images/xy_grid-medusa-ui.png new file mode 100644 index 0000000..0250c91 Binary files /dev/null and b/images/xy_grid-medusa-ui.png differ diff --git a/images/xy_grid-medusa.png b/images/xy_grid-medusa.png new file mode 100644 index 0000000..f28fdc6 Binary files /dev/null and b/images/xy_grid-medusa.png differ