From 14c4b36affa4535dd58012574e39e227c2b3d603 Mon Sep 17 00:00:00 2001 From: AbdBarho Date: Sat, 1 Oct 2022 12:57:53 +0200 Subject: [PATCH] v2 (#108) ### Update versions - auto: https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/3f417566b0bda8eab05d247567aebf001c1d1725 ### Breaking changes: * renamed `automatic-1111` service to `auto` * the `cache` folder is now deprecated, replaced with `data` (see migration guide below) * `embeddings` folder has been moved to `data/embeddings` * use GFPGAN 1.4 ### Migration Guide Note: in theory, running the command ``` docker compose --profile download up --build ``` is all you need to use the new version, however, this means you will also have to download everything again. A new script is available under `scripts/migratev1tov2.sh` that will copy models to the new structure and should get you most of the way, run ```bash ./scripts/migratev1tov2.sh ``` or you can manually inspect the script and copy the files After that, run ``` docker compose --profile download up --build ``` to validate everything. --- {scripts => .devscripts}/chmod.sh | 0 cache/.gitignore | 5 --- data/.gitignore | 13 ++++++ docker-compose.yml | 7 ++-- scripts/migratev1tov2.sh | 30 ++++++++++++++ services/AUTOMATIC1111/Dockerfile | 10 ++--- services/AUTOMATIC1111/mount.sh | 53 +++++++++++-------------- services/download/checksums.sha256 | 12 +++--- services/download/download.sh | 7 +++- services/download/links.txt | 14 +++---- services/hlky/Dockerfile | 6 +-- services/hlky/mount.sh | 39 ++++++++---------- services/hlky/userconfig_streamlit.yaml | 2 +- 13 files changed, 113 insertions(+), 85 deletions(-) rename {scripts => .devscripts}/chmod.sh (100%) delete mode 100644 cache/.gitignore create mode 100644 data/.gitignore create mode 100755 scripts/migratev1tov2.sh diff --git a/scripts/chmod.sh b/.devscripts/chmod.sh similarity index 100% rename from scripts/chmod.sh rename to .devscripts/chmod.sh diff --git a/cache/.gitignore b/cache/.gitignore deleted file mode 100644 index a2aafd4..0000000 --- a/cache/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/torch -/transformers -/weights -/models -/custom-models diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 0000000..d8caa8b --- /dev/null +++ b/data/.gitignore @@ -0,0 +1,13 @@ +# for all of the stuff downloaded by transformers, pytorch, and others +/.cache +# for all stable diffusion models (main, waifu diffusion, etc..) +/StableDiffusion +# others +/Codeformer +/GFPGAN +/ESRGAN +/BSRGAN +/RealESRGAN +/SwinIR +/LDSR +# TODO: add the embeddings folder here diff --git a/docker-compose.yml b/docker-compose.yml index e3f80b1..2674e83 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ x-base_service: &base_service ports: - "7860:7860" volumes: - - &v1 ./cache:/cache + - &v1 ./data:/data - &v2 ./output:/output deploy: resources: @@ -30,7 +30,7 @@ services: environment: - CLI_ARGS=--optimized-turbo - automatic1111: &automatic + auto: &automatic <<: *base_service profiles: ["auto"] build: ./services/AUTOMATIC1111 @@ -38,11 +38,10 @@ services: - *v1 - *v2 - ./services/AUTOMATIC1111/config.json:/stable-diffusion-webui/config.json - - ./embeddings:/stable-diffusion-webui/embeddings environment: - CLI_ARGS=--allow-code --medvram - automatic1111-cpu: + auto-cpu: <<: *automatic profiles: ["auto-cpu"] deploy: {} diff --git a/scripts/migratev1tov2.sh b/scripts/migratev1tov2.sh new file mode 100755 index 0000000..0b67158 --- /dev/null +++ b/scripts/migratev1tov2.sh @@ -0,0 +1,30 @@ +mkdir -p data/.cache data/StableDiffusion data/Codeformer data/GFPGAN data/ESRGAN data/BSRGAN data/RealESRGAN data/SwinIR data/LDSR /data/embeddings + +cp -vf cache/models/model.ckpt data/StableDiffusion/model.ckpt + +cp -vf cache/models/LDSR.ckpt data/LDSR/model.ckpt +cp -vf cache/models/LDSR.yaml data/LDSR/project.yaml + +cp -vf cache/models/RealESRGAN_x4plus.pth data/RealESRGAN/ +cp -vf cache/models/RealESRGAN_x4plus_anime_6B.pth data/RealESRGAN/ + +cp -vrf cache/torch data/.cache/ + +mkdir -p data/.cache/huggingface/transformers/ +cp -vrf cache/transformers/* data/.cache/huggingface/transformers/ + +cp -v cache/custom-models/* data/StableDiffusion/ + +mkdir -p data/.cache/clip/ +cp -vf cache/weights/ViT-L-14.pt data/.cache/clip/ + +cp -vf cache/weights/codeformer.pth data/Codeformer/codeformer-v0.1.0.pth + +cp -vf cache/weights/detection_Resnet50_Final.pth data/.cache/ +cp -vf cache/weights/parsing_parsenet.pth data/.cache/ + +cp -v embeddings/* data/embeddings/ + +echo this script was created 10/2022 +echo Dont forget to run: docker compose --profile download up --build +echo the cache and embeddings folders can be deleted, but its not necessary. diff --git a/services/AUTOMATIC1111/Dockerfile b/services/AUTOMATIC1111/Dockerfile index e11d0a5..f6a70a7 100644 --- a/services/AUTOMATIC1111/Dockerfile +++ b/services/AUTOMATIC1111/Dockerfile @@ -49,7 +49,7 @@ RUN pip install --prefer-binary --no-cache-dir -r ${ROOT}/repositories/CodeForme # Note: don't update the sha of previous versions because the install will take forever # instead, update the repo state in a later step -ARG SHA=f80c3696f63a181f720105559d42ee53453ed0eb +ARG SHA=3f417566b0bda8eab05d247567aebf001c1d1725 RUN <