Skip to content

Commit

Permalink
Update provisioning script for new base
Browse files Browse the repository at this point in the history
  • Loading branch information
robballantyne committed Jul 4, 2024
1 parent 1ba45a5 commit 2c5f2e3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 42 deletions.
34 changes: 13 additions & 21 deletions config/provisioning/default-rocm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@

DISK_GB_REQUIRED=30

MAMBA_PACKAGES=(
#"package1"
#"package2=version"
)

PIP_PACKAGES=(
)

)

EXTENSIONS=(
"https://github.com/Mikubill/sd-webui-controlnet"
"https://github.com/deforum-art/sd-webui-deforum"
"https://github.com/d8ahazard/sd_dreambooth_extension"
"https://github.com/adieyal/sd-dynamic-prompts"
"https://github.com/ototadana/sd-face-editor"
"https://github.com/AlUlkesh/stable-diffusion-webui-images-browser"
"https://github.com/hako-mikan/sd-webui-regional-prompter"
"https://github.com/Coyote-A/ultimate-upscale-for-automatic1111"
"https://github.com/fkunn1326/openpose-editor"
"https://github.com/Gourieff/sd-webui-reactor"
)

Expand Down Expand Up @@ -76,11 +71,12 @@ CONTROLNET_MODELS=(

function provisioning_start() {
source /opt/ai-dock/etc/environment.sh
source /opt/ai-dock/bin/venv-set.sh webui

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 \
Expand Down Expand Up @@ -108,20 +104,16 @@ function provisioning_start() {

# 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 \
source $WEBUI_VENV/bin/activate
LD_PRELOAD=libtcmalloc.so python launch.py \
${FLAGS_COMBINED}
deactivate
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[@]}
"$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]}
fi
}

Expand All @@ -134,15 +126,15 @@ function provisioning_get_extensions() {
if [[ ${AUTO_UPDATE,,} == "true" ]]; 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
if [[ -e $requirements ]]; then
"$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements"
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}"
"$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}"
fi
fi
done
Expand Down
35 changes: 14 additions & 21 deletions config/provisioning/default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@

DISK_GB_REQUIRED=30

MAMBA_PACKAGES=(
#"package1"
#"package2=version"
)

PIP_PACKAGES=(
"bitsandbytes==0.41.2.post2"
)

)

EXTENSIONS=(
"https://github.com/Mikubill/sd-webui-controlnet"
Expand All @@ -26,7 +21,6 @@ EXTENSIONS=(
"https://github.com/AlUlkesh/stable-diffusion-webui-images-browser"
"https://github.com/hako-mikan/sd-webui-regional-prompter"
"https://github.com/Coyote-A/ultimate-upscale-for-automatic1111"
"https://github.com/fkunn1326/openpose-editor"
"https://github.com/Gourieff/sd-webui-reactor"
)

Expand Down Expand Up @@ -77,11 +71,12 @@ CONTROLNET_MODELS=(

function provisioning_start() {
source /opt/ai-dock/etc/environment.sh
source /opt/ai-dock/bin/venv-set.sh webui

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 \
Expand Down Expand Up @@ -109,20 +104,16 @@ function provisioning_start() {

# 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 \
source "$WEBUI_VENV/bin/activate"
LD_PRELOAD=libtcmalloc.so python launch.py \
${FLAGS_COMBINED}
deactivate
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[@]}
"$WEBUI_VENV_PIP" install --no-cache-dir ${PIP_PACKAGES[@]}
fi
}

Expand All @@ -132,18 +123,20 @@ function provisioning_get_extensions() {
path="/opt/stable-diffusion-webui/extensions/${dir}"
requirements="${path}/requirements.txt"
if [[ -d $path ]]; then
# Pull only if AUTO_UPDATE
if [[ ${AUTO_UPDATE,,} == "true" ]]; 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
# Always pip install
if [[ -e $requirements ]]; then
"$WEBUI_VENV_PIP" install --no-cache-dir -r "$requirements"
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}"
"$WEBUI_VENV_PIP" install --no-cache-dir -r "${requirements}"
fi
fi
done
Expand Down

0 comments on commit 2c5f2e3

Please sign in to comment.