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 6 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
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

@PassiveLemon PassiveLemon May 8, 2023

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 && 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 [ "$(ls -A /stable-diffusion/custom_nodes)" ]; then
chmod 777 -R "/stable-diffusion/custom_nodes/"
Copy link
Owner

Choose a reason for hiding this comment

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

why is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Testing reasons. I wasn't going to bother fixing everything until there was a proposed solution

apt-get install build-essential -y
Copy link
Owner

Choose a reason for hiding this comment

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

we could move this into the dockerfile, where we install aria2 and others

for dir in "/stable-diffusion/custom_nodes/*"; do
if [ -e "$dir/requirements.txt" ]; then
echo $dir
cd $dir
pip install -r requirements.txt
fi
done
Copy link
Owner

Choose a reason for hiding this comment

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

I think we could simplify this loop

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

fi

exec "$@"