From 05829c5ae30325ac0bdedbc98c562645249ab3a1 Mon Sep 17 00:00:00 2001 From: Abdullah Barhoum Date: Mon, 29 Aug 2022 05:50:35 +0200 Subject: [PATCH] Make secondary models optional --- README.md | Bin 5380 -> 5424 bytes build/Dockerfile | 12 ++++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 40e221b7711100938ed975f523edad591ba9ad89..fdc78b0c99d5289e3e9e6630fd9f643faf644ab3 100644 GIT binary patch delta 69 zcmZqC+Mu)uOebhGp|479PgUTUcxO0XtL%1^@s6 diff --git a/build/Dockerfile b/build/Dockerfile index 3b9eaf2..a661b4f 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -35,13 +35,17 @@ COPY info.py /info.py RUN python /info.py /stable-diffusion/scripts/webui.py WORKDIR /stable-diffusion -ENV TRANSFORMERS_CACHE=/cache/transformers TORCH_HOME=/cache/torch CLI_ARGS="" +ENV TRANSFORMERS_CACHE=/cache/transformers TORCH_HOME=/cache/torch CLI_ARGS="" \ + GFPGAN_PATH=/stable-diffusion/src/gfpgan/experiments/pretrained_models/GFPGANv1.3.pth \ + RealESRGAN_PATH=/stable-diffusion/src/realesrgan/experiments/pretrained_models/RealESRGAN_x4plus.pth \ + RealESRGAN_ANIME_PATH=/stable-diffusion/src/realesrgan/experiments/pretrained_models/RealESRGAN_x4plus_anime_6B.pth EXPOSE 7860 CMD \ - ln -sf /models/GFPGANv1.3.pth /stable-diffusion/src/gfpgan/experiments/pretrained_models/GFPGANv1.3.pth && \ - ln -sf /models/RealESRGAN_x4plus.pth /stable-diffusion/src/realesrgan/experiments/pretrained_models/RealESRGAN_x4plus.pth && \ + (test -f /models/GFPGANv1.3.pth && ln -sf /models/GFPGANv1.3.pth "${GFPGAN_PATH}" && echo "Mounted GFPGAN"); \ + (test -f /models/RealESRGAN_x4plus.pth && ln -sf /models/RealESRGAN_x4plus.pth "${RealESRGAN_PATH}" && echo "Mounted RealESRGAN");\ + (test -f /models/RealESRGAN_x4plus_anime_6B.pth && ln -sf /models/RealESRGAN_x4plus_anime_6B.pth "${RealESRGAN_ANIME_PATH}" && echo "Mounted RealESRGAN_ANIME"); \ # force facexlib cache mkdir -p /cache/weights/ && rm -rf /opt/conda/lib/python3.8/site-packages/facexlib/weights && \ ln -sf /cache/weights/ /opt/conda/lib/python3.8/site-packages/facexlib/ && \ # run, -u to not buffer stdout / stderr - python3 -u scripts/webui.py --outdir /output --save-metadata --ckpt /models/model.ckpt ${CLI_ARGS} + python3 -u scripts/webui.py --outdir /output --ckpt /models/model.ckpt --save-metadata ${CLI_ARGS}