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

Update ComfyUI #451

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ services:
<<: *base_service
profiles: ["comfy"]
build: ./services/comfy/
image: sd-comfy:1
image: sd-comfy:2
tty: true
volumes:
- *v2
Comment on lines +79 to +80
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already mounted in the x-base-service, so there is no need to change the mounts here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the issue though. I know it's present in the base, but the save image node won't save the images to the hosts output directory unless it is present in the actual profile.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the output folder of the save image node? and does the output/comfy exist on your machine?

environment:
- CLI_ARGS=

Expand Down
17 changes: 11 additions & 6 deletions services/comfy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
FROM alpine:3.17 as xformers
RUN apk add --no-cache aria2
RUN aria2c -x 5 --dir / --out wheel.whl 'https://github.com/AbdBarho/stable-diffusion-webui-docker/releases/download/5.0.0/xformers-0.0.17.dev449-cp310-cp310-manylinux2014_x86_64.whl'
RUN aria2c -x 5 --dir / --out wheel.whl 'https://github.com/AbdBarho/stable-diffusion-webui-docker/releases/download/5.0.3/xformers-0.0.20.dev528-cp310-cp310-manylinux2014_x86_64-pytorch2.whl'


FROM python:3.10.9-slim

ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1

RUN --mount=type=cache,target=/root/.cache/pip pip install torch==1.13.1 torchvision --extra-index-url https://download.pytorch.org/whl/cu117
RUN apt-get update && apt-get install -y git aria2 build-essential && apt-get clean

RUN apt-get update && apt-get install -y git && apt-get clean
RUN --mount=type=cache,target=/cache --mount=type=cache,target=/root/.cache/pip \
aria2c -x 5 --dir /cache --out torch-2.0.0-cp310-cp310-linux_x86_64.whl -c \
https://download.pytorch.org/whl/cu118/torch-2.0.0%2Bcu118-cp310-cp310-linux_x86_64.whl && \
pip install /cache/torch-2.0.0-cp310-cp310-linux_x86_64.whl torchvision --index-url https://download.pytorch.org/whl/cu118

ENV ROOT=/stable-diffusion
RUN --mount=type=cache,target=/root/.cache/pip \
Expand All @@ -21,13 +24,13 @@ RUN --mount=type=cache,target=/root/.cache/pip \


RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,from=xformers,source=/wheel.whl,target=/xformers-0.0.17-cp310-cp310-linux_x86_64.whl \
pip install triton /xformers-0.0.17-cp310-cp310-linux_x86_64.whl
--mount=type=bind,from=xformers,source=/wheel.whl,target=/xformers-0.0.20.dev528-cp310-cp310-manylinux2014_x86_64.whl \
pip install /xformers-0.0.20.dev528-cp310-cp310-manylinux2014_x86_64.whl


WORKDIR ${ROOT}

ARG BRANCH=master SHA=884ea653c8d6fe19b3724f45a04a0d74cd881f2f
ARG BRANCH=master SHA=cb1551b819ecaa7d9044c13d0c8e8cfa4ff72830
RUN --mount=type=cache,target=/root/.cache/pip \
git fetch && \
git checkout ${BRANCH} && \
Expand All @@ -36,6 +39,8 @@ RUN --mount=type=cache,target=/root/.cache/pip \

# add info
COPY . /docker/
RUN cp /docker/extra_model_paths.yaml ${ROOT}
RUN chmod u+x /docker/entrypoint.sh

ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility NVIDIA_VISIBLE_DEVICES=all
ENV PYTHONPATH="${PYTHONPATH}:${PWD}" CLI_ARGS=""
Expand Down
12 changes: 12 additions & 0 deletions services/comfy/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,16 @@ for to_path in "${!MOUNTS[@]}"; do
echo Mounted $(basename "${from_path}")
done

if [ -f "/data/config/comfy/startup.sh" ]; then
pushd ${ROOT}
. /data/config/comfy/startup.sh
popd
fi

shopt -s nullglob
list=(${ROOT}/custom_nodes/*/requirements.txt)
for req in "${list[@]}"; do
pip install -r "$req"
done

Comment on lines +53 to +58
Copy link
Owner

@AbdBarho AbdBarho May 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do still think this should be separate, otherwise it could introduce so many bugs we cannot account for.
i.e. we build the container with certain dependencies, yet at startup they get overwritten by random ones from the extensions.

An example which is very frustrating that comes to mind is opencv-headless.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The save image node doesn't have a path, just a name I set it to. It should save the image to the output/ folder in the comfyui directory. /output/comfy does exist on my system.

Would it be possible to create a whole separate pip environment for the extensions alone? I'm not familiar with it or python so I don't know if it's possible and how it would be done anyways.

exec "$@"