Merge remote-tracking branch 'AbdBarho/master' into enable-deepdanbooru

This commit is contained in:
Michael Riegel 2022-11-02 21:23:36 -04:00
commit 4ff2228595
8 changed files with 54 additions and 39 deletions

View file

@ -2,4 +2,4 @@
set -Eeuo pipefail
find . -name "*.sh" -exec git update-index --chmod=+x {} \;
find services -name "*.sh" -exec git update-index --chmod=+x {} \;

View file

@ -23,20 +23,11 @@ services:
volumes:
- *v1
hlky:
<<: *base_service
profiles: ["hlky"]
build: ./services/hlky/
image: sd-hlky:3
environment:
- CLI_ARGS=--optimized-turbo
- USE_STREAMLIT=0
auto: &automatic
<<: *base_service
profiles: ["auto"]
build: ./services/AUTOMATIC1111
image: sd-auto:4
image: sd-auto:9
environment:
- CLI_ARGS=--allow-code --medvram --xformers
@ -47,11 +38,20 @@ services:
environment:
- CLI_ARGS=--no-half --precision full
hlky:
<<: *base_service
profiles: ["hlky"]
build: ./services/hlky/
image: sd-hlky:6
environment:
- CLI_ARGS=--optimized-turbo
- USE_STREAMLIT=0
lstein:
<<: *base_service
profiles: ["lstein"]
build: ./services/lstein/
image: sd-lstein:3
image: sd-lstein:4
environment:
- PRELOAD=true
- CLI_ARGS=

View file

@ -36,26 +36,28 @@ ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1 PIP_NO_CACHE_DIR=1
RUN pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
RUN apt-get update && apt install fonts-dejavu-core rsync git -y && apt-get clean
RUN apt-get update && apt install fonts-dejavu-core rsync git jq moreutils -y && apt-get clean
RUN <<EOF
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
git reset --hard 1eb588cbf19924333b88beaa1ac0041904966640
git reset --hard d885a4a57b72152745ca76192ef1bdda29e6461d
pip install -r requirements_versions.txt
EOF
ENV ROOT=/stable-diffusion-webui \
WORKDIR=/stable-diffusion-webui/repositories/stable-diffusion
COPY --from=xformers /wheel.whl xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl
RUN pip install xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl && rm xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl
ENV ROOT=/stable-diffusion-webui
COPY --from=download /git/ ${ROOT}
RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/data/* ${ROOT}/interrogate
RUN pip install --prefer-binary --no-cache-dir -r ${ROOT}/repositories/CodeFormer/requirements.txt
# TODO: move to top
RUN apt-get install jq moreutils -y
ARG DEEPDANBOORU="0"
RUN [[ ${DEEPDANBOORU:-"0"} == "0" ]] && : || pip install tensorflow-cpu==2.10 tensorflow-io==0.27.0 git+https://github.com/KichangKim/DeepDanbooru.git@edf73df4cdaeea2cf00e9ac08bd8a9026b7a7b26#egg=deepdanbooru
@ -63,10 +65,10 @@ RUN [[ ${DEEPDANBOORU:-"0"} == "0" ]] && : || pip install tensorflow-cpu==2.10 t
# 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=737eb28faca8be2bb996ee0930ec77d1f7ebd939
ARG SHA=cd5eafaf03a25d2b0e35154666947b9489078af9
RUN <<EOF
cd stable-diffusion-webui
git pull --rebase
git fetch
git reset --hard ${SHA}
pip install -r requirements_versions.txt
EOF
@ -74,21 +76,18 @@ EOF
RUN pip install opencv-python-headless \
git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 \
git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 \
pyngrok \
gradio==3.4.1
# gradio because #173 & https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/2858
pyngrok
COPY --from=xformers /wheel.whl xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl
RUN pip install xformers-0.0.14.dev0-cp310-cp310-linux_x86_64.whl
COPY . /docker
RUN <<EOF
chmod +x /docker/mount.sh && python3 /docker/info.py ${ROOT}/modules/ui.py
EOF
WORKDIR ${ROOT}/repositories/stable-diffusion
ENV CLI_ARGS=""
WORKDIR ${WORKDIR}
EXPOSE 7860
ENTRYPOINT ["/docker/entrypoint.sh"]
# run, -u to not buffer stdout / stderr
CMD /docker/mount.sh && \
python3 -u ../../webui.py --listen --port 7860 --ckpt-dir ${ROOT}/models/Stable-diffusion --theme dark ${CLI_ARGS}
CMD python3 -u ../../webui.py --listen --port 7860 --ckpt-dir ${ROOT}/models/Stable-diffusion --theme dark ${CLI_ARGS}

View file

@ -2,7 +2,8 @@
set -Eeuo pipefail
mkdir -p /data/config/auto/
# TODO: move all mkdir -p ?
mkdir -p /data/config/auto/scripts/
cp -n /docker/config.json /data/config/auto/config.json
jq '. * input' /data/config/auto/config.json /docker/config.json | sponge /data/config/auto/config.json
@ -10,6 +11,9 @@ if [ ! -f /data/config/auto/ui-config.json ]; then
echo '{}' >/data/config/auto/ui-config.json
fi
# copy scripts, we cannot just mount the directory because it will override the already provided scripts in the repo
cp -rfT /data/config/auto/scripts/ "${ROOT}/scripts"
declare -A MOUNTS
MOUNTS["/root/.cache"]="/data/.cache"
@ -29,6 +33,7 @@ MOUNTS["${ROOT}/models/hypernetworks"]="/data/Hypernetworks"
MOUNTS["${ROOT}/embeddings"]="/data/embeddings"
MOUNTS["${ROOT}/config.json"]="/data/config/auto/config.json"
MOUNTS["${ROOT}/ui-config.json"]="/data/config/auto/ui-config.json"
MOUNTS["${ROOT}/extensions"]="/data/config/auto/extensions"
# extra hacks
MOUNTS["${ROOT}/repositories/CodeFormer/weights/facelib"]="/data/.cache"
@ -46,3 +51,12 @@ for to_path in "${!MOUNTS[@]}"; do
done
mkdir -p /output/saved /output/txt2img-images/ /output/img2img-images /output/extras-images/ /output/grids/ /output/txt2img-grids/ /output/img2img-grids/
if [ -f "/data/config/auto/startup.sh" ]; then
pushd ${ROOT}
. /data/config/auto/startup.sh
popd
fi
exec "$@"

View file

@ -12,17 +12,20 @@ RUN conda install pytorch==1.11.0 torchvision==0.12.0 cudatoolkit=11.3 -c pytorc
RUN apt-get update && apt install fonts-dejavu-core rsync gcc -y && apt-get clean
ENV PIP_PREFER_BINARY=1 PIP_NO_CACHE_DIR=1
RUN <<EOF
git config --global http.postBuffer 1048576000
git clone https://github.com/sd-webui/stable-diffusion-webui.git stable-diffusion
git clone https://github.com/Sygil-Dev/sygil-webui.git stable-diffusion
cd stable-diffusion
git reset --hard 1a9c053cb7b6832695771db2555c0adc9b41e95f
git reset --hard 091520bed06f913c9f432f9f47ccbe22b46068d7
conda env update --file environment.yaml -n base
conda clean -a -y
EOF
RUN apt-get update && apt install libsndfile1 ffmpeg -y && apt-get clean
ARG BRANCH=dev SHA=5f6141ae7c8520b250896c80ac938396164f78df
ARG BRANCH=dev SHA=62f9706d6abf52c7a0facbfddbc22f98e2b3fa85
RUN <<EOF
cd stable-diffusion
git fetch

View file

@ -16,6 +16,7 @@ MOUNTS["${PWD}/models/custom"]=/data/StableDiffusion
# hack
MOUNTS["${PWD}/models/gfpgan/GFPGANv1.3.pth"]=/data/GFPGAN/GFPGANv1.4.pth
MOUNTS["${PWD}/models/gfpgan/GFPGANv1.4.pth"]=/data/GFPGAN/GFPGANv1.4.pth
MOUNTS["${PWD}/gfpgan/weights"]=/data/.cache
for to_path in "${!MOUNTS[@]}"; do

View file

@ -4,27 +4,25 @@ FROM continuumio/miniconda3:4.12.0
SHELL ["/bin/bash", "-ceuxo", "pipefail"]
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND=noninteractive PIP_EXISTS_ACTION=w PIP_PREFER_BINARY=1 PIP_NO_CACHE_DIR=1
# now it requires python3.9
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 apt-get update && apt install fonts-dejavu-core rsync gcc -y && apt-get clean
ENV PIP_EXISTS_ACTION=w
RUN apt-get update && apt install fonts-dejavu-core -y && apt-get clean
RUN <<EOF
git clone https://github.com/invoke-ai/InvokeAI.git stable-diffusion
cd stable-diffusion
git reset --hard 79e79b78aaeedb49afcc795e0e00eebfdbedee96
git reset --hard 986cc49d7a8441a70c709c04a55016a1c783f2ed
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
EOF
ARG BRANCH=development SHA=2b6d78e4363f3eca726228a40b6de832eb0ac040
ARG BRANCH=development SHA=fdf9b1c40c243d6806e787877e42ae4c115790ee
RUN <<EOF
cd stable-diffusion
git fetch