Last active
December 29, 2023 21:30
-
-
Save galekseev/71adada4dd5063303865aba5b2dfc1a6 to your computer and use it in GitHub Desktop.
SDXL + 13 XL models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/false | |
# This file will be sourced in init.sh | |
# Namespace functions with provisioning_ | |
# https://raw.githubusercontent.com/ai-dock/stable-diffusion-webui/main/config/provisioning/default.sh | |
### Edit the following arrays to suit your workflow - values must be quoted and separated by newlines or spaces. | |
DISK_GB_REQUIRED=20 | |
MAMBA_PACKAGES=( | |
#"package1" | |
#"package2=version" | |
) | |
PIP_PACKAGES=( | |
"bitsandbytes==0.41.2.post2" | |
) | |
EXTENSIONS=( | |
"https://github.com/Mikubill/sd-webui-controlnet" | |
"https://github.com/adieyal/sd-dynamic-prompts" | |
"https://github.com/hako-mikan/sd-webui-regional-prompter" | |
"https://github.com/Gourieff/sd-webui-reactor" | |
"https://github.com/LEv145/--sd-webui-ar-plus" | |
"https://github.com/ahgsql/StyleSelectorXL" | |
"https://github.com/some9000/StylePile" | |
"https://github.com/zixaphir/Stable-Diffusion-Webui-Civitai-Helper" | |
"https://github.com/Bing-su/adetailer" | |
"https://github.com/zanllp/sd-webui-infinite-image-browsing" | |
"https://github.com/Uminosachi/sd-webui-inpaint-anything" | |
"https://github.com/pharmapsychotic/clip-interrogator-ext" | |
# maybe useful some day | |
#"https://github.com/pharmapsychotic/clip-interrogator-ext" | |
#"https://github.com/Coyote-A/ultimate-upscale-for-automatic1111" | |
#"https://github.com/fkunn1326/openpose-editor" | |
#"https://github.com/wywywywy/sd-webui-depth-lib" | |
#"https://github.com/continue-revolution/sd-webui-segment-anything" | |
# don't need | |
#"https://github.com/d8ahazard/sd_dreambooth_extension" | |
#"https://github.com/deforum-art/sd-webui-deforum" | |
#"https://github.com/ototadana/sd-face-editor" # replaced with reactor | |
#"https://github.com/AlUlkesh/stable-diffusion-webui-images-browser" # replaced with infinite-image-browsing | |
) | |
EMBEDDINGS=( | |
# FastNegative | |
"https://civitai.com/api/download/models/159385" | |
# AC_NEG1 | |
"https://civitai.com/api/download/models/166373" | |
# AC_NEG2 | |
"https://civitai.com/api/download/models/166375" | |
) | |
CHECKPOINT_MODELS=( | |
# 6,5 Gb each | |
# SDXL | |
#"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors" | |
# SDXL fixed vae | |
"https://civitai.com/api/download/models/128078" | |
# Refiner | |
"https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors" | |
# Dreamshaper XL v1.0 alpha2 | |
"https://civitai.com/api/download/models/126688" | |
# Juggenaut XL v7 | |
"https://civitai.com/api/download/models/240840" | |
# Cinevision XL v1.5 | |
"https://civitai.com/api/download/models/211388" | |
# Dynavision XL v0.5.5.7 | |
"https://civitai.com/api/download/models/198962" | |
# Nightvision XL v0.7.9.1 | |
"https://civitai.com/api/download/models/247444" | |
# Protovision XL v0.6.3.0 | |
"https://civitai.com/api/download/models/201514" | |
# Faetastic XL v2.0 | |
"https://civitai.com/api/download/models/183500" | |
# Better then words v3.0 | |
"https://civitai.com/api/download/models/233092" | |
# Afrodite XL v1.1 | |
"https://civitai.com/api/download/models/243851" | |
# Albedo XL v1.3 | |
"https://civitai.com/api/download/models/238308" | |
# Copax TimeLessXL v8 | |
"https://civitai.com/api/download/models/198246" | |
# ZavyChromaXL v3.0 | |
"https://civitai.com/api/download/models/252831" | |
# YamerMIX Turbo Unstable v9 | |
"https://civitai.com/api/download/models/225259" | |
# SDVN6-RealXL Detailface | |
"https://civitai.com/api/download/models/134461") | |
LORA_MODELS=( | |
# ~ Lora models ~ => 1577 Mb | |
# Badhands XL 8 Mb | |
# Detail Tweaker XL 229 Mb | |
# More Artfull XL 719 Mb | |
# Cute Lora v1.0 22 Mb | |
# FaeTastic Details v1.0 218 Mb | |
# FraColor v1.0 341 Mb | |
# Perfect Eyes XL v1.0. 40 Mb | |
# Badhands XL | |
"https://civitai.com/api/download/models/141278" | |
# Detail Tweaker XL | |
"https://civitai.com/api/download/models/135867" | |
# More Artfull XL | |
"https://civitai.com/api/download/models/152309" | |
# Cute Lora v1.0 | |
"https://civitai.com/api/download/models/131616" | |
# FaeTastic Details v1.0 | |
"https://civitai.com/api/download/models/147951" | |
# FraColor v1.0 | |
"https://civitai.com/api/download/models/180996" | |
# Concept Perfect Eyes XL v1.0 | |
"https://civitai.com/api/download/models/129711" | |
) | |
VAE_MODELS=( | |
# SDXL VAE / 335 Mb | |
"https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors" | |
) | |
ESRGAN_MODELS=( | |
# ~ Upscalers ~ => 201 Mb | |
# RealESRGAN_x4 67 Mb | |
# Remacri 67 Mb | |
# UltraSharp 67 Mb | |
# AnimeSharp 67 Mb | |
# 4x_NMKD-Siax_200k 67 Mb | |
"https://huggingface.co/ai-forever/Real-ESRGAN/resolve/main/RealESRGAN_x4.pth" | |
"https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth" | |
"https://huggingface.co/lokCX/4x-Ultrasharp/resolve/main/4x-UltraSharp.pth" | |
"https://huggingface.co/konohashinobi4/4xAnimesharp/blob/main/4x-AnimeSharp.pth" | |
#"https://huggingface.co/Akumetsu971/SD_Anime_Futuristic_Armor/resolve/main/4x_NMKD-Siax_200k.pth" | |
) | |
CONTROLNET_MODELS=( | |
"https://huggingface.co/lllyasviel/sd_control_collection/blob/main/kohya_controllllite_xl_canny.safetensors" | |
"https://huggingface.co/lllyasviel/sd_control_collection/blob/main/kohya_controllllite_xl_depth.safetensors" | |
"https://huggingface.co/lllyasviel/sd_control_collection/blob/main/t2i-adapter_diffusers_xl_openpose.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_canny-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_depth-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_hed-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_mlsd-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_normal-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_openpose-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_scribble-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_seg-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_canny-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_color-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_depth-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_keypose-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_openpose-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_seg-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_sketch-fp16.safetensors" | |
#"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_style-fp16.safetensors" | |
) | |
### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ### | |
function provisioning_start() { | |
source /opt/ai-dock/etc/environment.sh | |
DISK_GB_AVAILABLE=$(($(df --output=avail -m "${WORKSPACE}" | tail -n1) / 1000)) | |
DISK_GB_USED=$(($(df --output=used -m "${WORKSPACE}" | tail -n1) / 1000)) | |
DISK_GB_ALLOCATED=$(($DISK_GB_AVAILABLE + $DISK_GB_USED)) | |
provisioning_print_header | |
provisioning_get_mamba_packages | |
provisioning_get_pip_packages | |
provisioning_get_extensions | |
provisioning_get_models \ | |
"${WORKSPACE}/storage/stable_diffusion/models/ckpt" \ | |
"${CHECKPOINT_MODELS[@]}" | |
provisioning_get_models \ | |
"${WORKSPACE}/storage/stable_diffusion/embeddings" \ | |
"${EMBEDDINGS[@]}" | |
provisioning_get_models \ | |
"${WORKSPACE}/storage/stable_diffusion/models/lora" \ | |
"${LORA_MODELS[@]}" | |
provisioning_get_models \ | |
"${WORKSPACE}/storage/stable_diffusion/models/controlnet" \ | |
"${CONTROLNET_MODELS[@]}" | |
provisioning_get_models \ | |
"${WORKSPACE}/storage/stable_diffusion/models/vae" \ | |
"${VAE_MODELS[@]}" | |
provisioning_get_models \ | |
"${WORKSPACE}/storage/stable_diffusion/models/esrgan" \ | |
"${ESRGAN_MODELS[@]}" | |
PLATFORM_FLAGS="" | |
if [[ $XPU_TARGET = "CPU" ]]; then | |
PLATFORM_FLAGS="--use-cpu all --skip-torch-cuda-test --no-half" | |
fi | |
PROVISIONING_FLAGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" | |
FLAGS_COMBINED="${PLATFORM_FLAGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_FLAGS}" | |
# Start and exit because webui will probably require a restart | |
cd /opt/stable-diffusion-webui && \ | |
micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ | |
${FLAGS_COMBINED} | |
provisioning_print_end | |
} | |
function provisioning_get_mamba_packages() { | |
if [[ -n $MAMBA_PACKAGES ]]; then | |
$MAMBA_INSTALL -n webui ${MAMBA_PACKAGES[@]} | |
fi | |
} | |
function provisioning_get_pip_packages() { | |
if [[ -n $PIP_PACKAGES ]]; then | |
micromamba run -n webui $PIP_INSTALL ${PIP_PACKAGES[@]} | |
fi | |
} | |
function provisioning_get_extensions() { | |
for repo in "${EXTENSIONS[@]}"; do | |
dir="${repo##*/}" | |
path="/opt/stable-diffusion-webui/extensions/${dir}" | |
requirements="${path}/requirements.txt" | |
if [[ -d $path ]]; then | |
if [[ ${AUTO_UPDATE,,} != "false" ]]; then | |
printf "Updating extension: %s...\n" "${repo}" | |
( cd "$path" && git pull ) | |
if [[ -e $requirements ]]; then | |
micromamba -n webui run ${PIP_INSTALL} -r "$requirements" | |
fi | |
fi | |
else | |
printf "Downloading extension: %s...\n" "${repo}" | |
git clone "${repo}" "${path}" --recursive | |
if [[ -e $requirements ]]; then | |
micromamba -n webui run ${PIP_INSTALL} -r "${requirements}" | |
fi | |
fi | |
done | |
} | |
function provisioning_get_models() { | |
if [[ -z $2 ]]; then return 1; fi | |
dir="$1" | |
mkdir -p "$dir" | |
shift | |
if [[ $DISK_GB_ALLOCATED -ge $DISK_GB_REQUIRED ]]; then | |
arr=("$@") | |
else | |
printf "WARNING: Low disk space allocation - Only the first model will be downloaded!\n" | |
arr=("$1") | |
fi | |
printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir" | |
for url in "${arr[@]}"; do | |
printf "Downloading: %s\n" "${url}" | |
provisioning_download "${url}" "${dir}" | |
printf "\n" | |
done | |
} | |
function provisioning_print_header() { | |
printf "\n##############################################\n# #\n# Provisioning container #\n# #\n# This will take some time #\n# #\n# Your container will be ready on completion #\n# #\n##############################################\n\n" | |
if [[ $DISK_GB_ALLOCATED -lt $DISK_GB_REQUIRED ]]; then | |
printf "WARNING: Your allocated disk size (%sGB) is below the recommended %sGB - Some models will not be downloaded\n" "$DISK_GB_ALLOCATED" "$DISK_GB_REQUIRED" | |
fi | |
} | |
function provisioning_print_end() { | |
printf "\nProvisioning complete: Web UI will start now\n\n" | |
} | |
# Download from $1 URL to $2 file path | |
function provisioning_download() { | |
wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" | |
} | |
provisioning_start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment