mirror of
https://github.com/AbdBarho/stable-diffusion-webui-docker.git
synced 2025-10-27 00:04:16 -04:00
This commit adds support for integrating Krita AI Diffusion models and nodes into the Comfy image editing application. It includes the following changes: - Downloads recommended models for Krita AI Diffusion if enabled - Symlinks the downloaded upscale models into the models directory - Adds environment variables to enable/disable dependancy node packs - Clones and sets up the required Git repositories for those node packs if enabled - Installs additional dependencies like aiohttp and tqdm if Krita AI Diffusion is used These changes allow Comfy to leverage the powerful image generation and editing capabilities provided by the Krita AI Diffusion project. Users can now access advanced features like outpainting, inpainting, upscaling, etc. within the Comfy UI. The commit also improves the build process by using a cache for pip installs and specifying types for mounted volumes in Docker for better performance and reproducibility.
70 lines
3.0 KiB
Bash
Executable File
70 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -Eeuo pipefail
|
|
|
|
CUSTOM_NODES="/data/config/comfy/custom_nodes"
|
|
mkdir -vp "${CUSTOM_NODES}"
|
|
|
|
declare -A MOUNTS
|
|
|
|
MOUNTS["${CACHE}"]="/data/.cache"
|
|
MOUNTS["${ROOT}/input"]="/data/config/comfy/input"
|
|
MOUNTS["${ROOT}/output"]="/output/comfy"
|
|
|
|
for to_path in "${!MOUNTS[@]}"; do
|
|
set -Eeuo pipefail
|
|
from_path="${MOUNTS[${to_path}]}"
|
|
rm -rf "${to_path}"
|
|
if [ ! -f "$from_path" ]; then
|
|
mkdir -vp "$from_path"
|
|
fi
|
|
mkdir -vp "$(dirname "${to_path}")"
|
|
ln -sT "${from_path}" "${to_path}"
|
|
echo Mounted $(basename "${from_path}")
|
|
done
|
|
|
|
|
|
if [ "${USE_KRITA}" = "true" ]; then
|
|
if [ "${KRITA_DOWNLOAD_MODELS:-false}" = "true" ]; then
|
|
cd "${ROOT}/krita-ai-diffusion/scripts" && python scripts/download_models.py --recommended /data && cd ..
|
|
cd "${ROOT}/models/" mv -v upscale_models upscale_models.stock && ln -sT /data/models/upscale_models upscale_models
|
|
fi
|
|
export USE_CNAUX="true" USE_IPAPLUS="true" USE_INPAINT="true"; USE_TOOLING="true"
|
|
fi
|
|
if [ "${USE_GGUF}" = "true" ]; then
|
|
[ ! -e "${CUSTOM_NODES}/ComfyUI-GGUF" ] && mv "${ROOT}/ComfyUI-GGUF" "${CUSTOM_NODES}"/
|
|
fi
|
|
if [ "${USE_XFLUX}" = "true" ]; then
|
|
[ ! -e "${CUSTOM_NODES}/x-flux-comfyui" ] && mv "${ROOT}/x-flux-comfyui" "${CUSTOM_NODES}"/
|
|
[ ! -e "/data/models/clip_vision" ] && mkdir -p /data/models/clip_vision
|
|
[ ! -e "/data/models/clip_vision/model.safetensors" ] && cd /data/models/clip_vision && \
|
|
python -c 'import sys; from urllib.request import urlopen; from pathlib import Path; Path(sys.argv[2]).write_bytes(urlopen("".join([sys.argv[1],sys.argv[2]])).read())' \
|
|
"https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/" "model.safetensors"
|
|
[ ! -e "/data/models/xlabs" ] && mkdir -p /data/models/xlabs/{ipadapters,loras,controlnets}
|
|
[ ! -e "/data/models/xlabs/ipadapters/flux-ip-adapter.safetensors" ] && cd /data/models/xlabs/ipadapters && \
|
|
python -c 'import sys; from urllib.request import urlopen; from pathlib import Path; Path(sys.argv[2]).write_bytes(urlopen("".join([sys.argv[1],sys.argv[2]])).read())' \
|
|
"https://huggingface.co/XLabs-AI/flux-ip-adapter/resolve/main/" "flux-ip-adapter.safetensors"
|
|
[ -d "${ROOT}/models/xlabs" ] && rm -rf "${ROOT}/models/xlabs"
|
|
[ ! -e "${ROOT}/models/xlabs" ] && cd "${ROOT}/models" && ln -sT /data/models/xlabs xlabs && cd ..
|
|
fi
|
|
if [ "${USE_CNAUX}" = "true" ]; then
|
|
[ ! -e "${CUSTOM_NODES}/comfyui_controlnet_aux" ] && mv "${ROOT}/comfyui_controlnet_aux" "${CUSTOM_NODES}"/
|
|
fi
|
|
if [ "${USE_IPAPLUS}" = "true" ]; then
|
|
[ ! -e "${CUSTOM_NODES}/ComfyUI_IPAdapter_plus" ] && mv "${ROOT}/ComfyUI_IPAdapter_plus" "${CUSTOM_NODES}"/
|
|
fi
|
|
if [ "${USE_INPAINT}" = "true" ]; then
|
|
[ ! -e "${CUSTOM_NODES}/comfyui-inpaint-nodes" ] && mv "${ROOT}/comfyui-inpaint-nodes" "${CUSTOM_NODES}"/
|
|
fi
|
|
if [ "${USE_TOOLING}" = "true" ]; then
|
|
[ ! -e "${CUSTOM_NODES}/comfyui-tooling-nodes" ] && mv "${ROOT}/comfyui-tooling-nodes" "${CUSTOM_NODES}"/
|
|
fi
|
|
|
|
if [ -f "/data/config/comfy/startup.sh" ]; then
|
|
pushd ${ROOT}
|
|
. /data/config/comfy/startup.sh
|
|
popd
|
|
fi
|
|
|
|
exec "$@"
|