-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgraded base allows provisioning script to alter init.sh vars No longer deleting most of the horde shell scripts. UX improved add vars to prevent running as a service and for installing dev dependencies
- Loading branch information
1 parent
495d0a7
commit 21343f4
Showing
18 changed files
with
107 additions
and
62 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ jobs: | |
pytorch: | ||
- "2.0.1" | ||
cuda: | ||
- "11.7.1" | ||
- "11.8.0" | ||
level: | ||
- "base" | ||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,61 @@ | ||
#!/bin/bash | ||
|
||
function main() { | ||
move_to_workspace | ||
copy_notebook | ||
update_horde | ||
set_safe_envs | ||
write_config | ||
#!/bin/false | ||
|
||
# This file will be sourced in init.sh | ||
|
||
function preflight_main() { | ||
preflight_move_to_workspace | ||
preflight_copy_notebook | ||
preflight_update_horde | ||
preflight_set_safe_envs | ||
preflight_write_config | ||
} | ||
|
||
function move_to_workspace() { | ||
function preflight_move_to_workspace() { | ||
if [[ $WORKSPACE_MOUNTED = "true" ]]; then | ||
if [[ ! -d "${WORKSPACE}AI-Horde-Worker" ]]; then | ||
if [[ ! -d ${WORKSPACE}AI-Horde-Worker ]]; then | ||
mv /opt/AI-Horde-Worker ${WORKSPACE} | ||
fi | ||
rm -rf /opt/AI-Horde-Worker | ||
ln -s "${WORKSPACE}/AI-Horde-Worker" /opt/AI-Horde-Worker | ||
ln -s ${WORKSPACE}AI-Horde-Worker /opt/AI-Horde-Worker | ||
fi | ||
} | ||
|
||
function copy_notebook() { | ||
function preflight_copy_notebook() { | ||
if micromamba env list | grep 'jupyter' > /dev/null 2>&1; then | ||
if [[ ! -f "${WORKSPACE}/dreamer.ipynb" ]]; then | ||
if [[ ! -f "${WORKSPACE}dreamer.ipynb" ]]; then | ||
cp /usr/local/share/ai-dock/dreamer.ipynb ${WORKSPACE} | ||
fi | ||
fi | ||
} | ||
|
||
function update_horde() { | ||
/opt/horde/bin/update-hordelib.sh | ||
function preflight_update_horde() { | ||
/opt/horde/bin/update-horde-worker.sh | ||
} | ||
|
||
function set_safe_envs() { | ||
function preflight_set_safe_envs() { | ||
DEFAULT_WORKER_NAME="Docker Dreamer" | ||
|
||
# Ensure worker_name for bridge_stable_diffusion.py -n | ||
if [[ -z $BRIDGE_WORKER_NAME || "$BRIDGE_WORKER_NAME" = $DEFAULT_WORKER_NAME ]]; then | ||
if [[ -z $BRIDGE_WORKER_NAME || $BRIDGE_WORKER_NAME = "$DEFAULT_WORKER_NAME" ]]; then | ||
export BRIDGE_WORKER_NAME="$DEFAULT_WORKER_NAME $(uuidgen -r)" | ||
fi | ||
|
||
if [[ -n $BRIDGE_DREAMER_NAME ]]; then | ||
if [[ -n $BRIDGE_DREAMER_NAME && $BRIDGE_DREAMER_NAME != $DEFAULT_WORKER_NAME ]]; then | ||
export BRIDGE_WORKER_NAME="${BRIDGE_DREAMER_NAME}" | ||
fi | ||
|
||
if [[ -z $BRIDGE_DREAMER_NAME ]]; then | ||
export BRIDGE_DREAMER_NAME="$BRIDGE_WORKER_NAME" | ||
fi | ||
|
||
# Terminal UI will not work when running as a service | ||
export BRIDGE_DISABLE_TERMINAL_UI=true | ||
if [[ $HORDE_SKIP_SERVICE != "true" ]]; then | ||
export BRIDGE_DISABLE_TERMINAL_UI=true | ||
fi | ||
} | ||
|
||
function write_config() { | ||
function preflight_write_config() { | ||
micromamba run -n horde python /opt/horde/scripts/write-config.py | ||
} | ||
|
||
main "$@"; exit | ||
preflight_main "$@" |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
update-hordelib.sh | ||
update-horde-worker.sh |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
if [[ $8 = "hordelib.benchmark" ]]; then | ||
micromamba run -n horde python -m hordelib.benchmark | ||
elif [[ $8 = *".py" ]]; then | ||
micromamba run -n horde python -s "${@:8}" | ||
else | ||
printf "The docker override does not understand your use case - Please raise an issue at https://github.com/ai-dock/ai-horde-dreamer\n" | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Just a regular file - Here to make runtime.sh proceed without updating |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This directory contains files to be copied into /opt/AI-Horde-Worker | ||
|
||
The purpose is to make the horde shell scripts work without having to | ||
modify them and cause problems with git pull | ||
|
||
update-runtime.sh will still be deleted because it wants to clobber bin/micromamba |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,13 @@ | |
ARG IMAGE_BASE="ghcr.io/ai-dock/pytorch:2.0.1-py3.10-cuda-11.8.0-base-22.04" | ||
FROM ${IMAGE_BASE} | ||
|
||
LABEL org.opencontainers.image.source https://github.com/ai-dock/pytorch | ||
LABEL org.opencontainers.image.source https://github.com/ai-dock/ai-horde-dreamer | ||
|
||
LABEL org.opencontainers.image.description "Jupyter with Python kernels and pytorch pre-installed" | ||
LABEL org.opencontainers.image.description "AI Horde image generation worker" | ||
|
||
LABEL maintainer="Rob Ballantyne <[email protected]>" | ||
|
||
# Note: the default mamba environment is set by ai-dock/python | ||
|
||
# Add new paths at front | ||
#ENV PATH=/opt/another/bin:$PATH | ||
ENV PATH=/opt/horde/bin:$PATH | ||
|
||
# Copy early so we can use scripts in the build - Changes to these files will invalidate the cache and cause a rebuild. | ||
COPY ./COPY_ROOT/ / | ||
|
@@ -23,7 +20,6 @@ COPY ./COPY_ROOT/ / | |
ARG IMAGE_BASE | ||
RUN bash -c /opt/ai-dock/bin/build/layer0/init.sh | ||
|
||
ENV PATH=/opt/horde/bin:$PATH | ||
ENV MAMBA_DEFAULT_ENV=horde | ||
|
||
# Keep init.sh as-is and place additional logic in /opt/ai-dock/bin/preflight.sh | ||
|
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
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