Skip to content
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ This repository provides multiple UIs for you to play around with stable diffusi
| -------------------------------------------------------------------------------- |
| ![](https://github.com/comfyanonymous/ComfyUI/raw/master/comfyui_screenshot.png) |

### [Fooocus](https://github.com/comfyanonymous/ComfyUI)

[Full feature list here](https://github.com/lllyasviel/Fooocus#fooocus), Screenshot:

| Simplified UI |
| -------------------------------------------------------------------------------- |
| ![](https://github.com/lllyasviel/Fooocus/assets/19834515/483fb86d-c9a2-4c20-997c-46dafc124f25) |

## Contributing

Contributions are welcome! **Create a discussion first of what the problem is and what you want to contribute (before you implement anything)**
Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,11 @@ services:
deploy: {}
environment:
- CLI_ARGS=--cpu

fooocus: &fooocus
<<: *base_service
profiles: ["fooocus"]
build: ./services/fooocus/
image: sd-fooocus:3
environment:
- CLI_ARGS=
18 changes: 18 additions & 0 deletions services/comfy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1

RUN apt-get update && apt-get install -y git && apt-get clean

# add some packages for some custom nodes in comfyui
RUN apt-get install 'libglib2.0-0' -y
RUN apt-get update
RUN apt-get install 'libgl1-mesa-glx' -y
RUN apt-get install 'python-dev' -y

# install pip package for codeformer face detection custom node
RUN pip install lpips

ENV ROOT=/stable-diffusion
RUN --mount=type=cache,target=/root/.cache/pip \
git clone https://github.com/comfyanonymous/ComfyUI.git ${ROOT} && \
Expand All @@ -13,6 +22,15 @@ RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements.txt

WORKDIR ${ROOT}

ARG BRANCH=master SHA=c97be4db91d4a249c19afdf88fa1cf3268544e45
RUN --mount=type=cache,target=/root/.cache/pip \
git fetch && \
git checkout ${BRANCH} && \
git reset --hard ${SHA} && \
pip install -r requirements.txt

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

Expand Down
28 changes: 28 additions & 0 deletions services/comfy/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,34 @@ MOUNTS["/root/.cache"]="/data/.cache"
MOUNTS["${ROOT}/input"]="/data/config/comfy/input"
MOUNTS["${ROOT}/output"]="/output/comfy"

# mount various locations for comfyui to keep custom nodes and models downloaded with comfyui manager
MOUNTS["${ROOT}/custom_nodes"]="/data/config/comfy/custom_nodes"

MOUNTS["${ROOT}/models/checkpoints"]="/data/models/checkpoints"
#MOUNTS["${ROOT}/models/configs"]="/data/models/configs"
MOUNTS["${ROOT}/models/embeddings"]="/data/models/embeddings"
MOUNTS["${ROOT}/models/gligen"]="/data/models/gligen"
MOUNTS["${ROOT}/models/mmdets"]="/data/models/mmdets"
MOUNTS["${ROOT}/models/style_models"]="/data/models/style_models"
#MOUNTS["${ROOT}/models/vae"]="/data/models/vae"
#MOUNTS["${ROOT}/models/clip"]="/data/models/clip"
#MOUNTS["${ROOT}/models/controlnet"]="/data/models/controlnet"
MOUNTS["${ROOT}/models/facedetection"]="/data/models/facedetection"

MOUNTS["${ROOT}/models/hypernetworks"]="/data/models/hypernetworks"


#MOUNTS["${ROOT}/models/onnx"]="/data/models/onnx"
#MOUNTS["${ROOT}/models/unet"]="/data/models/unet"
MOUNTS["${ROOT}/models/vae_approx"]="/data/models/vae-approx"
#MOUNTS["${ROOT}/models/clip_vision"]="/data/models/clip_vision"
#MOUNTS["${ROOT}/models/diffusers"]="/data/models/diffusers"
MOUNTS["${ROOT}/models/facerestore_models"]="/data/models/facerestore_models"
MOUNTS["${ROOT}/models/loras"]="/data/models/lora"
MOUNTS["${ROOT}/models/sams"]="/data/models/sams"
MOUNTS["${ROOT}/models/upscale_models"]="/data/models/upscale_models"


for to_path in "${!MOUNTS[@]}"; do
set -Eeuo pipefail
from_path="${MOUNTS[${to_path}]}"
Expand Down
18 changes: 16 additions & 2 deletions services/comfy/extra_model_paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ a111:
checkpoints: models/Stable-diffusion
configs: models/Stable-diffusion
vae: models/VAE
loras: models/Lora
#loras: models/Lora
upscale_models: |
models/RealESRGAN
models/ESRGAN
Expand All @@ -16,10 +16,24 @@ a111:
clip: models/CLIPEncoder
embeddings: embeddings

custom_nodes: config/comfy/custom_nodes
#custom_nodes: config/comfy/custom_nodes

# TODO: I am unsure about these, need more testing
# style_models: config/comfy/style_models
# t2i_adapter: config/comfy/t2i_adapter
# clip_vision: config/comfy/clip_vision
# diffusers: config/comfy/diffusers

# may not need these since I'm adding mounts instead
#facerestore_models: models/facerestore_models
#sams: models/sams
#unet: models/unet
#vae_approx: models/vae_approx
#face_restore: models/face_restore
#mmdets: models/mmdets
#style_models: models/style_models
#clip_vision: models/clip_vision
#diffusers: models/diffusers
#facedetection: models/facedetection
#onnx: models/onnx
#ultralytics: models/ultralytics
47 changes: 47 additions & 0 deletions services/fooocus/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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/6.0.0/xformers-0.0.21.dev544-cp310-cp310-manylinux2014_x86_64-pytorch201.whl'

FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime

ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1

RUN apt-get update && apt-get install -y git && apt-get clean

# add in required packages
RUN apt-get install 'libglib2.0-0' -y
RUN apt-get install 'libgl1-mesa-glx' -y
RUN apt-get install 'python-dev' -y

# set this to your target branch commit
ARG BRANCH=main SHA=d7439b2d6004d50a0fda19108603a8d1941a185e

ENV ROOT=/stable-diffusion
RUN --mount=type=cache,target=/root/.cache/pip \
git clone https://github.com/lllyasviel/Fooocus.git ${ROOT} && \
cd ${ROOT} && \
git checkout ${BRANCH} && \
git reset --hard ${SHA} && \
pip install -r requirements_versions.txt


RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,from=xformers,source=/wheel.whl,target=/xformers-0.0.21-cp310-cp310-linux_x86_64.whl \
pip install /xformers-0.0.21-cp310-cp310-linux_x86_64.whl

WORKDIR ${ROOT}

RUN --mount=type=cache,target=/root/.cache/pip \
git fetch && \
git checkout ${BRANCH} && \
git reset --hard ${SHA} && \
pip install -r requirements_versions.txt

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

EXPOSE 7860
ENTRYPOINT ["/docker/entrypoint.sh"]
CMD python -u entry_with_update.py --listen --port 7860 ${CLI_ARGS}
12 changes: 12 additions & 0 deletions services/fooocus/config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"path_checkpoints": "/stable-diffusion/models/checkpoints",
"path_loras": "/stable-diffusion/models/loras",
"path_embeddings": "/stable-diffusion/models/embeddings",
"path_vae_approx": "/stable-diffusion/models/vae_approx",
"path_upscale_models": "/stable-diffusion/models/upscale_models",
"path_inpaint": "/stable-diffusion/models/inpaint",
"path_controlnet": "/stable-diffusion/models/controlnet",
"path_clip_vision": "/stable-diffusion/models/clip_vision",
"path_fooocus_expansion": "/stable-diffusion/models/prompt_expansion/fooocus_expansion",
"path_outputs": "/stable-diffusion/outputs"
}
33 changes: 33 additions & 0 deletions services/fooocus/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -Eeuo pipefail

mkdir -vp /data/config/fooocus/wildcards

declare -A MOUNTS

MOUNTS["${ROOT}/outputs"]="/output/fooocus"

# ui specific mounts
MOUNTS["${ROOT}/models/checkpoints"]=/data/models/Stable-diffusion/
MOUNTS["${ROOT}/models/loras"]=/data/models/Lora/
MOUNTS["${ROOT}/models/embeddings"]=/data/models/embeddings/
MOUNTS["${ROOT}/models/vae_approx"]=/data/models/VAE/
MOUNTS["${ROOT}/models/upscale_models"]=/data/models/upscale_models/
MOUNTS["${ROOT}/wildcards"]=/data/config/fooocus/wildcards

for to_path in "${!MOUNTS[@]}"; do
set -Eeuo pipefail
from_path="${MOUNTS[${to_path}]}"
rm -rf "${to_path}"
mkdir -p "$(dirname "${to_path}")"
# ends with slash, make it!
if [[ "$from_path" == */ ]]; then
mkdir -vp "$from_path"
fi

ln -sT "${from_path}" "${to_path}"
echo Mounted $(basename "${from_path}")
done

exec "$@"