Răsfoiți Sursa

Invoke AI v2.1 (#195)

https://github.com/invoke-ai/InvokeAI/commit/6b89adfa7ebd4591ed91a76ecf152e3517cda385
AbdBarho 4 ani în urmă
părinte
comite
1cfb915d12

+ 1 - 0
data/.gitignore

@@ -14,4 +14,5 @@
 /ScuNET
 /ScuNET
 /LDSR
 /LDSR
 /Hypernetworks
 /Hypernetworks
+/VAE
 /embeddings
 /embeddings

+ 2 - 2
docker-compose.yml

@@ -51,7 +51,7 @@ services:
     <<: *base_service
     <<: *base_service
     profiles: ["lstein"]
     profiles: ["lstein"]
     build: ./services/lstein/
     build: ./services/lstein/
-    image: sd-lstein:4
+    image: sd-lstein:5
     environment:
     environment:
       - PRELOAD=true
       - PRELOAD=true
-      - CLI_ARGS=
+      - CLI_ARGS=--max_loaded_models=1

+ 1 - 0
services/download/checksums.sha256

@@ -4,3 +4,4 @@ e2cd4703ab14f4d01fd1383a8a8b266f9a5833dacee8e6a79d3bf21a1b6be5ad  /data/GFPGAN/G
 f872d837d3c90ed2e05227bed711af5671a6fd1c9f7d7e91c911a61f155e99da  /data/RealESRGAN/RealESRGAN_x4plus_anime_6B.pth
 f872d837d3c90ed2e05227bed711af5671a6fd1c9f7d7e91c911a61f155e99da  /data/RealESRGAN/RealESRGAN_x4plus_anime_6B.pth
 c209caecac2f97b4bb8f4d726b70ac2ac9b35904b7fc99801e1f5e61f9210c13  /data/LDSR/model.ckpt
 c209caecac2f97b4bb8f4d726b70ac2ac9b35904b7fc99801e1f5e61f9210c13  /data/LDSR/model.ckpt
 9d6ad53c5dafeb07200fb712db14b813b527edd262bc80ea136777bdb41be2ba  /data/LDSR/project.yaml
 9d6ad53c5dafeb07200fb712db14b813b527edd262bc80ea136777bdb41be2ba  /data/LDSR/project.yaml
+c6a580b13a5bc05a5e16e4dbb80608ff2ec251a162311590c1f34c013d7f3dab  /data/VAE/vae-ft-mse-840000-ema-pruned.ckpt

+ 2 - 0
services/download/links.txt

@@ -8,6 +8,8 @@ magnet:?xt=urn:btih:2daef5b5f63a16a9af9169a529b1a773fc452637&dn=v1-5-pruned-emao
   check-integrity=true
   check-integrity=true
 https://drive.yerf.org/wl/?id=EBfTrmcCCUAGaQBXVIj5lJmEhjoP1tgl&mode=grid&download=1
 https://drive.yerf.org/wl/?id=EBfTrmcCCUAGaQBXVIj5lJmEhjoP1tgl&mode=grid&download=1
   out=StableDiffusion/model.ckpt
   out=StableDiffusion/model.ckpt
+https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt
+  out=VAE/vae-ft-mse-840000-ema-pruned.ckpt
 https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth
 https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth
   out=GFPGAN/GFPGANv1.4.pth
   out=GFPGAN/GFPGANv1.4.pth
 https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth
 https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth

+ 9 - 8
services/lstein/Dockerfile

@@ -8,21 +8,22 @@ ENV DEBIAN_FRONTEND=noninteractive PIP_EXISTS_ACTION=w  PIP_PREFER_BINARY=1 PIP_
 
 
 # now it requires python3.9
 # now it requires python3.9
 RUN conda install python=3.9 && conda clean -a -y
 RUN conda install python=3.9 && conda clean -a -y
-RUN conda install pytorch==1.11.0 torchvision==0.12.0 cudatoolkit=11.3 -c pytorch && conda clean -a -y
+RUN conda install cudatoolkit=11.6 -c conda-forge && conda clean -a -y
+RUN conda install pytorch==1.12.1 -c pytorch && conda clean -a -y
 
 
 RUN apt-get update && apt install fonts-dejavu-core -y && apt-get clean
 RUN apt-get update && apt install fonts-dejavu-core -y && apt-get clean
 
 
 RUN <<EOF
 RUN <<EOF
 git clone https://github.com/invoke-ai/InvokeAI.git stable-diffusion
 git clone https://github.com/invoke-ai/InvokeAI.git stable-diffusion
 cd stable-diffusion
 cd stable-diffusion
-git reset --hard 986cc49d7a8441a70c709c04a55016a1c783f2ed
+git reset --hard 6b89adfa7ebd4591ed91a76ecf152e3517cda385
 git config --global http.postBuffer 1048576000
 git config --global http.postBuffer 1048576000
-# conda env update --file environment.yml -n base
+conda env update --file environment.yml -n base
 conda clean -a -y
 conda clean -a -y
 EOF
 EOF
 
 
 
 
-ARG BRANCH=development SHA=fdf9b1c40c243d6806e787877e42ae4c115790ee
+ARG BRANCH=main SHA=6b89adfa7ebd4591ed91a76ecf152e3517cda385
 RUN <<EOF
 RUN <<EOF
 cd stable-diffusion
 cd stable-diffusion
 git fetch
 git fetch
@@ -33,12 +34,11 @@ conda env update --file environment.yml -n base
 conda clean -a -y
 conda clean -a -y
 EOF
 EOF
 
 
-RUN pip uninstall opencv-python -y && pip install --prefer-binary --force-reinstall --no-cache-dir opencv-python-headless
+RUN pip uninstall opencv-python -y && pip install --force-reinstall opencv-python-headless==4.5.5.64
 
 
 COPY . /docker/
 COPY . /docker/
 RUN <<EOF
 RUN <<EOF
 python3 /docker/info.py /stable-diffusion/frontend/dist/index.html
 python3 /docker/info.py /stable-diffusion/frontend/dist/index.html
-chmod +x /docker/mount.sh
 EOF
 EOF
 
 
 
 
@@ -46,5 +46,6 @@ ENV PRELOAD=false CLI_ARGS=""
 WORKDIR /stable-diffusion
 WORKDIR /stable-diffusion
 EXPOSE 7860
 EXPOSE 7860
 
 
-CMD /docker/mount.sh && \
-  python3 -u scripts/invoke.py --outdir /output --web --host 0.0.0.0 --port 7860 ${CLI_ARGS}
+
+ENTRYPOINT ["/docker/entrypoint.sh"]
+CMD python3 -u scripts/invoke.py --outdir /output --web --host 0.0.0.0 --port 7860 ${CLI_ARGS}

+ 4 - 2
services/lstein/mount.sh → services/lstein/entrypoint.sh

@@ -7,9 +7,9 @@ declare -A MOUNTS
 # cache
 # cache
 MOUNTS["/root/.cache"]=/data/.cache
 MOUNTS["/root/.cache"]=/data/.cache
 # ui specific
 # ui specific
-MOUNTS["${PWD}/models/ldm/stable-diffusion-v1/model.ckpt"]=/data/StableDiffusion/model.ckpt
 MOUNTS["${PWD}/src/gfpgan/experiments/pretrained_models/GFPGANv1.4.pth"]=/data/GFPGAN/GFPGANv1.4.pth
 MOUNTS["${PWD}/src/gfpgan/experiments/pretrained_models/GFPGANv1.4.pth"]=/data/GFPGAN/GFPGANv1.4.pth
 MOUNTS["${PWD}/ldm/invoke/restoration/codeformer/weights"]=/data/Codeformer
 MOUNTS["${PWD}/ldm/invoke/restoration/codeformer/weights"]=/data/Codeformer
+MOUNTS["${PWD}/configs/models.yaml"]=/docker/models.yaml
 # hacks
 # hacks
 MOUNTS["/opt/conda/lib/python3.9/site-packages/facexlib/weights"]=/data/.cache
 MOUNTS["/opt/conda/lib/python3.9/site-packages/facexlib/weights"]=/data/.cache
 MOUNTS["/opt/conda/lib/python3.9/site-packages/realesrgan/weights"]=/data/RealESRGAN
 MOUNTS["/opt/conda/lib/python3.9/site-packages/realesrgan/weights"]=/data/RealESRGAN
@@ -25,5 +25,7 @@ for to_path in "${!MOUNTS[@]}"; do
 done
 done
 
 
 if "${PRELOAD}" == "true"; then
 if "${PRELOAD}" == "true"; then
-  python3 -u scripts/preload_models.py
+  python3 -u scripts/preload_models.py --no-interactive
 fi
 fi
+
+exec "$@"

+ 15 - 0
services/lstein/models.yaml

@@ -0,0 +1,15 @@
+# This file describes the alternative machine learning models
+# available to InvokeAI script.
+#
+# To add a new model, follow the examples below. Each
+# model requires a model config file, a weights file,
+# and the width and height of the images it
+# was trained on.
+stable-diffusion-1.5:
+  description: The newest Stable Diffusion version 1.5 weight file (4.27 GB)
+  weights: /data/StableDiffusion/v1-5-pruned-emaonly.ckpt
+  config: ./configs/stable-diffusion/v1-inference.yaml
+  width: 512
+  height: 512
+  vae: /data/VAE/vae-ft-mse-840000-ema-pruned.ckpt
+  default: true