diff --git a/README.md b/README.md index b6b576a..7ff099b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# 🌟 Stable Diffusion Templates +# 🗃 Stable Diffusion Templates -This is curated collection of templates for [Vast.ai](https://cloud.vast.ai/create/?ref_id=62878) and [Runpod.io](https://runpod.io/console/deploy?ref=gzvzzzv9) services. Their main purpose is to simplify the process of getting started with Stable Diffusion. These templates gives ready to use [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) thanks to [AI-Dock](https://github.com/ai-dock/stable-diffusion-webui). Plus they have some nice Lora's and useful Extensions preinstalled. +This is curated collection of templates for [Vast.ai](https://cloud.vast.ai/create/?ref_id=62878) and [Runpod.io](https://runpod.io/console/deploy?ref=gzvzzzv9) services. +Their main purpose is to simplify the process of getting started with Stable Diffusion. +These templates gives ready to use [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) thanks to [AI-Dock](https://github.com/ai-dock/stable-diffusion-webui). Plus they have some nice Lora's and useful Extensions preinstalled. -Mentioned services give you access to powerful GPUs like [RTX4090](https://www.nvidia.com/en-us/geforce/graphics-cards/40-series/rtx-4090/) at low cost. - -Additional informations will be added soon. +### Start generating graphics in minutes with just few clicks 😎 # 🦓 SDXL @@ -35,7 +35,35 @@ Templates with checkpoints based on Pony Diffusion XL. | - | [AutismMix](https://civitai.com/models/288584?modelVersionId=324619) | `V1` | Vast.ai | Runpod.io | | - | [fennfoto](https://civitai.com/models/503537?modelVersionId=676770) | `V3` | Vast.ai | Runpod.io | -## 📋 TODO's +# 🙊 What is [Vast.ai](https://cloud.vast.ai/create/?ref_id=62878) and [Runpod.io](https://runpod.io/console/deploy?ref=gzvzzzv9) ? + +These are services that gives you access to powerful [GPUs](https://en.wikipedia.org/wiki/Graphics_processing_unit) like [RTX4090](https://www.nvidia.com/en-us/geforce/graphics-cards/40-series/rtx-4090/) at low cost. +They let you run [Docker images](https://docs.docker.com/guides/docker-overview/#what-can-i-use-docker-for) on their servers. + +If you can't afford to buy a powerful Graphics Card (that is mandatory in graphics generation), these services are for you. In my opinion, services like these are the best way to get started with Stable Diffusion when you have weak graphics card and you don't have money to buy a powerful one. Btw. You can read [my old article](https://dav.one/the-ways-and-costs-of-generating-graphics-using-stable-diffusion) about _"the ways and costs of generating graphics"_. + +These two services offer a lot of different machines with different hardware. There are also community machines that are cheaper. Both services have machine browsers where you can find the best machine for your needs. Currently renting community machine with RTX4090 on [Vast.ai](https://cloud.vast.ai/create/?ref_id=62878) costs about $0.2 per hour. On [Runpod.io](https://runpod.io/console/deploy?ref=gzvzzzv9) it's a little bit more expensive. + +When you are registered on these services and logged in, you can use the links above to rent a machine with selected template. **It's super easy.** + +# 🙉 What is [AI-Dock](https://github.com/ai-dock/stable-diffusion-webui) and [Provisioning Script](https://github.com/ai-dock/base-image/wiki/4.0-Running-the-Image#provisioning-script) ? + +[AI-Dock](https://github.com/ai-dock/stable-diffusion-webui) allows users to run _Stable Diffusion_ with latest version of [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) in a Docker container. In my opinion the biggest advantage of this solution is that it starts quickly and you are able to connect to machine before all the checkpoints are downloaded. Because of that you can know at the beginning if docker image will work on machine you rented. Without AI-Dock you might waste few minutes waiting for checkpoints to download and then you will find out that something is wrong and you need to rent another machine. Except that AI-Dock comes with [Provisioning Script](https://github.com/ai-dock/base-image/wiki/4.0-Running-the-Image#provisioning-script), which is a script that installs all the necessary dependencies and downloads the checkpoints before starting the WebUI. So you don't need to do anything manually and you don't need to restart the container after installing specific extensions. + +Except [Automatic1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui), AI-Dock supports also other popular WebUIs like [ComfyUI](https://github.com/comfyanonymous/ComfyUI), [InvokeAI](https://github.com/invoke-ai/InvokeAI) and [Foooocus](https://github.com/lllyasviel/Fooocus). All templates in this repository are based on Auto1111, because it's my favorite one. + +# 🙈 Provisioning scripts in my Templates + +Provisioning scripts in this Collection are based on official [Provisioning Script](https://github.com/ai-dock/stable-diffusion-webui/blob/main/config/provisioning/default.sh). +In process of creating my provisioning scripts I'm replacing some parts of original script with my own stuff. Currently it includes: + +- Each script has just one spedific checkpoint. Does not include stock checkpoints. +- Each script has some useful Lora's that will work with that checkpoint. Basically there are two lists of Lora's - one for checkpoints based on SDXL and one for checkpoints based on PDXL. +- Each script has some useful Extensions. Basically the same for all scripts. Except `taggers`. + +In near future I will also add some useful Embeddings (Textual Inversions). + +# 📋 TODO's - [x] Create Workflows for automatic updates. - [x] Create Workflow for detecting changes in original Provisioning script. @@ -47,7 +75,7 @@ Templates with checkpoints based on Pony Diffusion XL. - [ ] Create Lite versions (without Loras). - [ ] Find a way to automate the creation and modification of templates so that Playwright isn't needed. -## 🗃 FAQ +# ♻️ FAQ `Q` Will you add more models? `A` Yes. Currently I need to create templates manually, because these services does not provide API for managing templates. Believe me, it's a pain. diff --git a/scripts/autismmixsdxl_autismmixpony.sh b/scripts/autismmixsdxl_autismmixpony.sh index 38bcaa4..7e578a9 100644 --- a/scripts/autismmixsdxl_autismmixpony.sh +++ b/scripts/autismmixsdxl_autismmixpony.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -68,6 +76,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -75,6 +87,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -100,17 +113,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -127,13 +159,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -171,7 +203,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/chinook_v10.sh b/scripts/chinook_v10.sh index 1e583b0..9208f9b 100644 --- a/scripts/chinook_v10.sh +++ b/scripts/chinook_v10.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/copaxtimelessxlsdxl1_v12.sh b/scripts/copaxtimelessxlsdxl1_v12.sh index 7eb7d51..dd0bf19 100644 --- a/scripts/copaxtimelessxlsdxl1_v12.sh +++ b/scripts/copaxtimelessxlsdxl1_v12.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/dreamshaperxl_alpha2xl10.sh b/scripts/dreamshaperxl_alpha2xl10.sh index 91c54e8..b2283c4 100644 --- a/scripts/dreamshaperxl_alpha2xl10.sh +++ b/scripts/dreamshaperxl_alpha2xl10.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/epicrealismxl_v8kiss.sh b/scripts/epicrealismxl_v8kiss.sh index f3656d9..89c048b 100644 --- a/scripts/epicrealismxl_v8kiss.sh +++ b/scripts/epicrealismxl_v8kiss.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/fennfotopony_v3.sh b/scripts/fennfotopony_v3.sh index f5cdfc6..87b4c3b 100644 --- a/scripts/fennfotopony_v3.sh +++ b/scripts/fennfotopony_v3.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -68,6 +76,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -75,6 +87,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -100,17 +113,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -127,13 +159,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -171,7 +203,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/goddessofrealism_gorponyv10.sh b/scripts/goddessofrealism_gorponyv10.sh index 6b93c0c..2abe32c 100644 --- a/scripts/goddessofrealism_gorponyv10.sh +++ b/scripts/goddessofrealism_gorponyv10.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -68,6 +76,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -75,6 +87,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -100,17 +113,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -127,13 +159,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -171,7 +203,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/halcyonsdxl_v18.sh b/scripts/halcyonsdxl_v18.sh index 796f520..b3af82a 100644 --- a/scripts/halcyonsdxl_v18.sh +++ b/scripts/halcyonsdxl_v18.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/juggernaut_x_rundiffusion.sh b/scripts/juggernaut_x_rundiffusion.sh index e0093e4..fe93db0 100644 --- a/scripts/juggernaut_x_rundiffusion.sh +++ b/scripts/juggernaut_x_rundiffusion.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/leosamshelloworldxl_helloworldxl70.sh b/scripts/leosamshelloworldxl_helloworldxl70.sh index fea89ec..956066c 100644 --- a/scripts/leosamshelloworldxl_helloworldxl70.sh +++ b/scripts/leosamshelloworldxl_helloworldxl70.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/photopediaxl_45.sh b/scripts/photopediaxl_45.sh index 530f599..e94a69b 100644 --- a/scripts/photopediaxl_45.sh +++ b/scripts/photopediaxl_45.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/ponydiffusionv6xl_v6startwiththisone.sh b/scripts/ponydiffusionv6xl_v6startwiththisone.sh index 41182a2..a4d0fff 100644 --- a/scripts/ponydiffusionv6xl_v6startwiththisone.sh +++ b/scripts/ponydiffusionv6xl_v6startwiththisone.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -68,6 +76,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -75,6 +87,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -100,17 +113,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -127,13 +159,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -171,7 +203,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/wildcardxxl_v4rundiffusion.sh b/scripts/wildcardxxl_v4rundiffusion.sh index 0514690..3c458bf 100644 --- a/scripts/wildcardxxl_v4rundiffusion.sh +++ b/scripts/wildcardxxl_v4rundiffusion.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/zavychromaxl_v70.sh b/scripts/zavychromaxl_v70.sh index 05ff05f..7143990 100644 --- a/scripts/zavychromaxl_v70.sh +++ b/scripts/zavychromaxl_v70.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file diff --git a/scripts/zavychromaxl_v90.sh b/scripts/zavychromaxl_v90.sh index f3193f7..c53ba00 100644 --- a/scripts/zavychromaxl_v90.sh +++ b/scripts/zavychromaxl_v90.sh @@ -2,7 +2,15 @@ DISK_GB_REQUIRED=40 -PIP_PACKAGES=() +APT_PACKAGES=( + #"package-1" + #"package-2" +) + +PIP_PACKAGES=( + #"package-1" + #"package-2" +) EXTENSIONS=( 'https://github.com/Mikubill/sd-webui-controlnet' @@ -46,6 +54,10 @@ CONTROLNET_MODELS=() EMBEDDINGS=() function provisioning_start() { + + if [[ ! -d /opt/environments/python ]]; then + export MAMBA_BASE=true + fi source /opt/ai-dock/etc/environment.sh source /opt/ai-dock/bin/venv-set.sh webui @@ -53,6 +65,7 @@ function provisioning_start() { 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_apt_packages provisioning_get_pip_packages provisioning_get_extensions provisioning_get_models \ @@ -78,17 +91,36 @@ function provisioning_start() { PROVISIONING_ARGS="--skip-python-version-check --no-download-sd-model --do-not-download-clip --port 11404 --exit" ARGS_COMBINED="${PLATFORM_ARGS} $(cat /etc/a1111_webui_flags.conf) ${PROVISIONING_ARGS}" - cd /opt/stable-diffusion-webui && \ - source "$WEBUI_VENV/bin/activate" - LD_PRELOAD=libtcmalloc.so python launch.py \ - ${ARGS_COMBINED} - deactivate + cd /opt/stable-diffusion-webui + if [[ -z $MAMBA_BASE ]]; then + source "$WEBUI_VENV/bin/activate" + LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + deactivate + else + micromamba run -n webui -e LD_PRELOAD=libtcmalloc.so python launch.py \ + ${ARGS_COMBINED} + fi provisioning_print_end } +function pip_install() { + if [[ -z $MAMBA_BASE ]]; then + "$WEBUI_VENV_PIP" install --no-cache-dir "$@" + else + micromamba run -n webui pip install --no-cache-dir "$@" + fi +} + +function provisioning_get_apt_packages() { + if [[ -n $APT_PACKAGES ]]; then + $APT_INSTALL ${APT_PACKAGES[@]} + fi +} + function provisioning_get_pip_packages() { if [[ -n $PIP_PACKAGES ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]} + pip_install ${PIP_PACKAGES[@]} fi } @@ -105,13 +137,13 @@ function provisioning_get_extensions() { fi if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements" + pip_install -r "$requirements" fi else printf "Downloading extension: %s...\n" "${repo}" git clone "${repo}" "${path}" --recursive if [[ -e $requirements ]]; then - "$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}" + pip_install -r "${requirements}" fi fi done @@ -149,7 +181,17 @@ function provisioning_print_end() { } function provisioning_download() { - wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then + auth_token="$HF_TOKEN" + elif + [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then + auth_token="$CIVITAI_TOKEN" + fi + if [[ -n $auth_token ]];then + wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + else + wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" + fi } provisioning_start \ No newline at end of file