Install

File structure

tree .
.
├── CODEOWNERS
├── LICENSE.txt
├── README.md
├── *embeddings
│   └── Place Textual Inversion embeddings here.txt
├── models
│   ├── Codeformer
│   ├── ESRGAN
│   ├── GFPGAN
│   ├── LDSR
│   ├── *Lora
│      ├── japaneseDollLikeness_v10.safetensors
│      ├── koreanDollLikeness_v10.safetensors
│      ├── shirtliftv1.safetensors
│      ├── skirtlift-v4.safetensors
│      └── taiwanDollLikeness_v10.safetensors
│   ├── *Stable-diffusion
│      ├── Chilloutmix-Ni-pruned-fp32-fix.safetensors
│      ├── Liberty.safetensors
│      ├── Put Stable Diffusion checkpoints here.txt
│      └── v1-5-pruned-emaonly.safetensors
│   ├── SwinIR
│   ├── *VAE
│      └── Put VAE here.txt
│   ├── VAE-approx
│      └── model.pt
│   ├── deepbooru
│      └── Put your deepbooru release project folder here.txt
│   ├── hypernetworks
│   └── karlo
│       └── ViT-L-14_stats.th
├── ui-config.json
├── .....
└── webui.sh

Install

pytorch environment

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu117
pip install xformers==0.0.20

clone repo

cd /root
rm -rf stable-diffusion-webui
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui --depth 1
cd stable-diffusion-webui

Install Extension

git clone 插件到 stable-diffusion-webui/extensions 目录下

cd extensions
git clone https://github.com/toshiaki1729/stable-diffusion-webui-dataset-tag-editor.git --depth 1    # tag editor
git clone https://github.com/kohya-ss/sd-webui-additional-networks --depth 1    # additional network

Launch

COMMANDLINE_ARGS="--port 7860 --no-download-sd-model --skip-torch-cuda-test --no-hashing --listen --skip-install" REQS_FILE="requirements.txt" python launch.py

Q & A

Problems

  1. error There is no current event loop in thread 'AnyIO worker thread when use api issue: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/9046 fix: https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9319

in one world. insert following code snipt before line 70 in webui.py

import asyncio
if sys.platform == "win32" and hasattr(asyncio, "WindowsSelectorEventLoopPolicy"):
    # "Any thread" and "selector" should be orthogonal, but there's not a clean
    # interface for composing policies so pick the right base.
    _BasePolicy = asyncio.WindowsSelectorEventLoopPolicy  # type: ignore
else:
    _BasePolicy = asyncio.DefaultEventLoopPolicy


class AnyThreadEventLoopPolicy(_BasePolicy):  # type: ignore
    """Event loop policy that allows loop creation on any thread.
    The default `asyncio` event loop policy only automatically creates
    event loops in the main threads. Other threads must create event
    loops explicitly or `asyncio.get_event_loop` (and therefore
    `.IOLoop.current`) will fail. Installing this policy allows event
    loops to be created automatically on any thread, matching the
    behavior of Tornado versions prior to 5.0 (or 5.0 on Python 2).
    Usage::
        asyncio.set_event_loop_policy(AnyThreadEventLoopPolicy())
    .. versionadded:: 5.0
    """

    def get_event_loop(self) -> asyncio.AbstractEventLoop:
        try:
            return super().get_event_loop()
        except (RuntimeError, AssertionError):
            # This was an AssertionError in python 3.4.2 (which ships with debian jessie)
            # and changed to a RuntimeError in 3.4.3.
            # "There is no current event loop in thread %r"
            loop = self.new_event_loop()
            self.set_event_loop(loop)
            return loop


asyncio.set_event_loop_policy(AnyThreadEventLoopPolicy())
  1. Skipping unknown extra network: lora issue & fix: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7984

  2. vae-ft-mse-840000-ema-pruned.safetensors 的作用 The intent was to fine-tune on the Stable Diffusion training set (the autoencoder was originally trained on OpenImages) but also enrich the dataset with images of humans to improve the reconstruction of faces.

https://huggingface.co/stabilityai/sd-vae-ft-mse-original https://www.reddit.com/r/StableDiffusion/comments/ya21at/download_the_improved_15_model_with_much_better/