Skip to content

Commit 23757d2

Browse files
authored
1 parent 9e7979b commit 23757d2

File tree

3 files changed

+37
-25
lines changed

3 files changed

+37
-25
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ services:
5151
<<: *base_service
5252
profiles: ["lstein"]
5353
build: ./services/lstein/
54-
image: sd-lstein:6
54+
image: sd-lstein:7
5555
environment:
5656
- PRELOAD=true
5757
- CLI_ARGS=--max_loaded_models=1

services/lstein/Dockerfile

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM continuumio/miniconda3:4.12.0
3+
FROM python:3.10-slim
44

55
SHELL ["/bin/bash", "-ceuxo", "pipefail"]
66

77
ENV DEBIAN_FRONTEND=noninteractive PIP_EXISTS_ACTION=w PIP_PREFER_BINARY=1 PIP_NO_CACHE_DIR=1
88

9-
# now it requires python3.9
10-
RUN conda install python=3.9 && conda clean -a -y
11-
RUN conda install cudatoolkit=11.6 -c conda-forge && conda clean -a -y
12-
RUN conda install pytorch==1.12.1 -c pytorch && conda clean -a -y
139

14-
RUN apt-get update && apt install fonts-dejavu-core -y && apt-get clean
10+
RUN pip install torch==1.13.0 torchvision --extra-index-url https://download.pytorch.org/whl/cu117
11+
12+
RUN apt-get update && apt-get install git -y && apt-get clean
13+
14+
RUN git clone https://github.com/invoke-ai/InvokeAI.git /stable-diffusion
15+
16+
WORKDIR /stable-diffusion
1517

1618
RUN <<EOF
17-
git clone https://github.com/invoke-ai/InvokeAI.git stable-diffusion
18-
cd stable-diffusion
19-
git reset --hard 6b89adfa7ebd4591ed91a76ecf152e3517cda385
19+
git reset --hard 2b7e3abe57963d199f1d825ddef87ae154c81045
2020
git config --global http.postBuffer 1048576000
21-
conda env update --file environment.yml -n base
22-
conda clean -a -y
21+
ln -sf environments-and-requirements/requirements-lin-cuda.txt requirements.txt
22+
pip install -r requirements.txt
2323
EOF
2424

2525

26-
ARG BRANCH=main SHA=6b89adfa7ebd4591ed91a76ecf152e3517cda385
26+
ARG BRANCH=development SHA=2b7e3abe57963d199f1d825ddef87ae154c81045
2727
RUN <<EOF
28-
cd stable-diffusion
2928
git fetch
3029
git reset --hard
3130
git checkout ${BRANCH}
3231
git reset --hard ${SHA}
33-
conda env update --file environment.yml -n base
34-
conda clean -a -y
32+
pip install -r requirements.txt
3533
EOF
3634

3735
RUN pip uninstall opencv-python -y && pip install --force-reinstall opencv-python-headless==4.5.5.64
@@ -42,8 +40,7 @@ python3 /docker/info.py /stable-diffusion/frontend/dist/index.html
4240
EOF
4341

4442

45-
ENV PRELOAD=false CLI_ARGS=""
46-
WORKDIR /stable-diffusion
43+
ENV ROOT=/stable-diffusion PRELOAD=false CLI_ARGS=""
4744
EXPOSE 7860
4845

4946

services/lstein/entrypoint.sh

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,36 @@ declare -A MOUNTS
66

77
# cache
88
MOUNTS["/root/.cache"]=/data/.cache
9+
910
# ui specific
10-
MOUNTS["${PWD}/src/gfpgan/experiments/pretrained_models/GFPGANv1.4.pth"]=/data/GFPGAN/GFPGANv1.4.pth
11-
MOUNTS["${PWD}/ldm/invoke/restoration/codeformer/weights"]=/data/Codeformer
12-
MOUNTS["${PWD}/configs/models.yaml"]=/docker/models.yaml
11+
MOUNTS["${ROOT}/models/codeformer"]=/data/Codeformer/
12+
13+
MOUNTS["${ROOT}/models/gfpgan/GFPGANv1.4.pth"]=/data/GFPGAN/GFPGANv1.4.pth
14+
MOUNTS["${ROOT}/models/gfpgan/weights"]=/data/.cache/
15+
16+
MOUNTS["${ROOT}/models/realesrgan"]=/data/RealESRGAN/
17+
18+
MOUNTS["${ROOT}/models/bert-base-uncased"]=/data/.cache/huggingface/transformers
19+
MOUNTS["${ROOT}/models/openai/clip-vit-large-patch14"]=/data/.cache/huggingface/transformers
20+
MOUNTS["${ROOT}/models/CompVis/stable-diffusion-safety-checker"]=/data/.cache/huggingface/transformers
21+
22+
MOUNTS["${ROOT}/configs/models.yaml"]=/docker/models.yaml
1323
# hacks
14-
MOUNTS["/opt/conda/lib/python3.9/site-packages/facexlib/weights"]=/data/.cache
15-
MOUNTS["/opt/conda/lib/python3.9/site-packages/realesrgan/weights"]=/data/RealESRGAN
16-
MOUNTS["${PWD}/src/realesrgan/weights"]=/data/RealESRGAN
17-
MOUNTS["${PWD}/gfpgan/weights"]=/data/.cache
24+
MOUNTS["/opt/conda/lib/python3.10/site-packages/facexlib/weights"]=/data/.cache/
25+
MOUNTS["${ROOT}/models/clipseg"]=/data/.cache/invoke/clipseg/
26+
27+
# MOUNTS["/opt/conda/lib/python3.9/site-packages/realesrgan/weights"]=/data/RealESRGAN
1828

1929
for to_path in "${!MOUNTS[@]}"; do
2030
set -Eeuo pipefail
2131
from_path="${MOUNTS[${to_path}]}"
2232
rm -rf "${to_path}"
2333
mkdir -p "$(dirname "${to_path}")"
34+
# ends with slash, make it!
35+
if [[ "$from_path" == */ ]]; then
36+
mkdir -vp "$from_path"
37+
fi
38+
2439
ln -sT "${from_path}" "${to_path}"
2540
echo Mounted $(basename "${from_path}")
2641
done

0 commit comments

Comments
 (0)