Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-deploy-1 #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
22 changes: 18 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand All @@ -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"]
Expand All @@ -52,26 +53,39 @@ 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 .

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

Expand Down
2 changes: 1 addition & 1 deletion builder/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from webui import initialize
from webui_forge import initialize
import modules.interrogate

initialize.initialize()
Expand Down
41 changes: 29 additions & 12 deletions builder/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion src/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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