From ce4333625829e3cfc3d902970e650e5d28be9095 Mon Sep 17 00:00:00 2001 From: shanu Date: Tue, 21 Jan 2025 13:19:00 +0530 Subject: [PATCH 1/2] aws-deploy-1 --- .DS_Store | Bin 0 -> 6148 bytes Dockerfile | 21 ++++++++++++++------ builder/requirements.txt | 41 +++++++++++++++++++++++++++------------ src/start.sh | 2 +- 4 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b988e06f199c75ef0d117299385c0eb0cbf2dcc2 GIT binary patch literal 6148 zcmeHK!A`*@R!dpK<5>K8g){9quz+eeNT1p^z@zOu>1N1xmF5m17(54U# z2V=-gvir8PGdt7QWtSl$H&`cqqAn4&&=`X@x;?`4+-ef2<^t&a8VQYQnNIq{=e%ZZ zivP#}f4egp(VC`|QtA6;3rRQltXpJx9FNj`gqc?Fa&|L#|GL{}mHfhL@xr@h6YZLV zcCd>w*ll&w}%8(2ADyT+OWA z+0B%5dA!>4q<-b-_1S8?uoUlgxSXf?d;%4IbtcAuF<=ZF!GN9~t@9&%&BYin22Ps+ zJ|99f#z?Uc^hXCeUjhJ|PM zIF0PILUBGi)(^coxk%7@W55`wGSHC6F5mwThwJ~UlRX&&#=uE2;F|F;9^jSqZmqo> v-?bsy6B-NK6@ptA4E$9LTfT~WXkMTXc>s(Q3qfcg_D8_eV4X4Wrwn`p+QMvj literal 0 HcmV?d00001 diff --git a/Dockerfile b/Dockerfile index 6d8c647..efacd60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,8 @@ RUN . /clone.sh BLIP https://github.com/salesforce/BLIP.git 48211a1594f1321b00f1 . /clone.sh generative-models https://github.com/Stability-AI/generative-models 45c443b316737a4ab6e40413d7794a7f5657c19f RUN apk add --no-cache wget && \ - wget -q -O /model.safetensors https://civitai.com/api/download/models/15236 + wget -q -O /model.safetensors https://civitai.com/api/download/models/266360 && \ + wget -q -O /verybadimagenegative_v1.3.pt https://civitai.com/api/download/models/25820 @@ -35,7 +36,7 @@ ARG SHA=5ef669de080814067961f28357256e8fe27544f4 ENV DEBIAN_FRONTEND=noninteractive \ PIP_PREFER_BINARY=1 \ LD_PRELOAD=libtcmalloc.so \ - ROOT=/stable-diffusion-webui \ + ROOT=/stable-diffusion-webui-forge \ PYTHONUNBUFFERED=1 SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -52,28 +53,36 @@ RUN --mount=type=cache,target=/cache --mount=type=cache,target=/root/.cache/pip pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 RUN --mount=type=cache,target=/root/.cache/pip \ - git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \ - cd stable-diffusion-webui && \ + git clone https://github.com/lllyasviel/stable-diffusion-webui-forge.git && \ + cd stable-diffusion-webui-forge && \ git reset --hard ${SHA} + +RUN python -m venv /stable-diffusion-webui-forge/venv +ENV PATH="/stable-diffusion-webui-forge/venv/bin:$PATH" +ENV PYTHONPATH=/stable-diffusion-webui-forge + #&& \ pip install -r requirements_versions.txt COPY --from=download /repositories/ ${ROOT}/repositories/ COPY --from=download /model.safetensors /model.safetensors +COPY --from=download /verybadimagenegative_v1.3.pt ${ROOT}/embeddings/ RUN mkdir ${ROOT}/interrogate && cp ${ROOT}/repositories/clip-interrogator/data/* ${ROOT}/interrogate RUN --mount=type=cache,target=/root/.cache/pip \ + . ${ROOT}/venv/bin/activate && \ pip install -r ${ROOT}/repositories/CodeFormer/requirements.txt # Install Python dependencies (Worker Template) COPY builder/requirements.txt /requirements.txt RUN --mount=type=cache,target=/root/.cache/pip \ + . ${ROOT}/venv/bin/activate && \ pip install --upgrade pip && \ pip install --upgrade -r /requirements.txt --no-cache-dir && \ rm /requirements.txt ADD src . -COPY builder/cache.py /stable-diffusion-webui/cache.py -RUN cd /stable-diffusion-webui && python cache.py --use-cpu=all --ckpt /model.safetensors +COPY builder/cache.py /stable-diffusion-webui-forge/cache.py +RUN cd /stable-diffusion-webui-forge && python cache.py --use-cpu=all --ckpt /model.safetensors # Cleanup section (Worker Template) RUN apt-get autoremove -y && \ diff --git a/builder/requirements.txt b/builder/requirements.txt index 8703e5f..032c49f 100644 --- a/builder/requirements.txt +++ b/builder/requirements.txt @@ -1,38 +1,42 @@ # Core Libraries -fastapi[all]==0.94.0 -pydantic<2 -runpod==1.7.2 +setuptools==69.5.1 # temp fix for compatibility with some old packages +fastapi==0.104.1 +pydantic==2.8.2 +runpod==1.0.0 # Image Processing Libraries opencv-python-headless==4.8.1.78 -Pillow==10.2.0 +Pillow==9.5.0 scikit-image==0.21.0 +pillow-avif-plugin==1.4.3 # Machine Learning Libraries accelerate==0.21.0 basicsr==1.4.2 einops==0.4.1 -gradio==4.11.0 +gradio==4.40.0 kornia==0.6.7 -numpy==1.23.5 +numpy==1.26.2 omegaconf==2.2.3 pytorch_lightning==1.9.4 realesrgan==0.3.0 -safetensors==0.3.1 +safetensors==0.4.2 timm==0.9.2 torch torchdiffeq==0.2.3 -torchsde==0.2.5 -transformers==4.36.0 +torchsde==0.2.6 +transformers==4.46.1 +xformers --index-url https://download.pytorch.org/whl/cu118 # CLI and Development Utilities -GitPython==3.1.41 +GitPython==3.1.32 pyngrok==7.0.0 # Web and Networking Libraries httpcore==0.15 inflection==0.5.1 jsonmerge==1.8.0 +httpx==0.24.1 # Miscellaneous Libraries blendmodes==2022 @@ -42,9 +46,22 @@ piexif==1.1.3 psutil==5.9.5 resize-right==0.0.2 tomesd==0.1.3 +tqdm==4.66.1 +peft==0.13.2 +huggingface-hub==0.26.2 # Direct Git Dependencies -# These dependencies are directly cloned from GitHub. Ensure the specified commits/tags are compatible. git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1 -git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b + +# Additional Libraries from A +facexlib==0.3.0 +diskcache==5.6.3 +open-clip-torch==2.20.0 +protobuf==3.20.0 +spandrel==0.3.4 +spandrel-extra-arches==0.1.1 +diffusers==0.31.0 +gradio_rangeslider==0.0.6 +gradio_imageslider==0.0.20 +loadimg==0.1.2 \ No newline at end of file diff --git a/src/start.sh b/src/start.sh index 60bd64b..6a09afc 100644 --- a/src/start.sh +++ b/src/start.sh @@ -3,7 +3,7 @@ echo "Worker Initiated" echo "Starting WebUI API" -python /stable-diffusion-webui/webui.py --skip-python-version-check --skip-torch-cuda-test --skip-install --ckpt /model.safetensors --lowram --opt-sdp-attention --disable-safe-unpickle --port 3000 --api --nowebui --skip-version-check --no-hashing --no-download-sd-model & +python /stable-diffusion-webui-forge/webui.py --skip-python-version-check --skip-torch-cuda-test --skip-install --ckpt /model.safetensors --lowram --opt-sdp-attention --disable-safe-unpickle --port 3000 --api --nowebui --skip-version-check --no-hashing --no-download-sd-model & echo "Starting RunPod Handler" python -u /rp_handler.py From 1be7d0faf5228edc9dd28c77afda9eb172d3338b Mon Sep 17 00:00:00 2001 From: shanu Date: Tue, 21 Jan 2025 16:10:47 +0530 Subject: [PATCH 2/2] modified file --- Dockerfile | 9 +++++++-- builder/cache.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index efacd60..cbc76e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,8 +81,13 @@ RUN --mount=type=cache,target=/root/.cache/pip \ ADD src . -COPY builder/cache.py /stable-diffusion-webui-forge/cache.py -RUN cd /stable-diffusion-webui-forge && python cache.py --use-cpu=all --ckpt /model.safetensors +ENV PYTHONPATH="/stable-diffusion-webui-forge" +WORKDIR /stable-diffusion-webui-forge +# Rename webui.py to webui_forge.py +RUN mv /stable-diffusion-webui-forge/webui.py /stable-diffusion-webui-forge/webui_forge.py + +COPY builder/cache.py /stable-diffusion-webui/cache.py +RUN cd /stable-diffusion-webui && python cache.py --use-cpu=all --ckpt /model.safetensors # Cleanup section (Worker Template) RUN apt-get autoremove -y && \ diff --git a/builder/cache.py b/builder/cache.py index 9d4da27..7057653 100644 --- a/builder/cache.py +++ b/builder/cache.py @@ -1,4 +1,4 @@ -from webui import initialize +from webui_forge import initialize import modules.interrogate initialize.initialize()