mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
3996ee843c
- launcher scripts are installed *before* the configure script runs, so that if something goes wrong in the configure script, the user can run invoke.{sh,bat} and get the option to re-run configure - fixed typo in invoke.sh which misspelled name of invokeai-configure
76 lines
2.0 KiB
Bash
76 lines
2.0 KiB
Bash
#!/bin/bash
|
|
|
|
####
|
|
# This launch script assumes that:
|
|
# 1. it is located in the runtime directory,
|
|
# 2. the .venv is also located in the runtime directory and is named exactly that
|
|
#
|
|
# If both of the above are not true, this script will likely not work as intended.
|
|
# Activate the virtual environment and run `invoke.py` directly.
|
|
####
|
|
|
|
set -eu
|
|
|
|
# ensure we're in the correct folder in case user's CWD is somewhere else
|
|
scriptdir=$(dirname "$0")
|
|
cd "$scriptdir"
|
|
|
|
. .venv/bin/activate
|
|
|
|
export INVOKEAI_ROOT="$scriptdir"
|
|
|
|
# set required env var for torch on mac MPS
|
|
if [ "$(uname -s)" == "Darwin" ]; then
|
|
export PYTORCH_ENABLE_MPS_FALLBACK=1
|
|
fi
|
|
|
|
if [ "$0" != "bash" ]; then
|
|
echo "Do you want to generate images using the"
|
|
echo "1. command-line"
|
|
echo "2. browser-based UI"
|
|
echo "3. run textual inversion training"
|
|
echo "4. merge models (diffusers type only)"
|
|
echo "5. open the developer console"
|
|
echo "6. re-run the configure script to download new models"
|
|
echo "7. command-line help "
|
|
echo ""
|
|
read -p "Please enter 1, 2, 3, 4, 5, 6 or 7: [2] " yn
|
|
choice=${yn:='2'}
|
|
case $choice in
|
|
1)
|
|
echo "Starting the InvokeAI command-line..."
|
|
exec invokeai $@
|
|
;;
|
|
2)
|
|
echo "Starting the InvokeAI browser-based UI..."
|
|
exec invokeai --web $@
|
|
;;
|
|
3)
|
|
echo "Starting Textual Inversion:"
|
|
exec textual_inversion --gui $@
|
|
;;
|
|
4)
|
|
echo "Merging Models:"
|
|
exec merge_models --gui $@
|
|
;;
|
|
5)
|
|
echo "Developer Console:"
|
|
file_name=$(basename "${BASH_SOURCE[0]}")
|
|
bash --init-file "$file_name"
|
|
;;
|
|
6)
|
|
exec invokeai-configure --root ${INVOKEAI_ROOT}
|
|
;;
|
|
7)
|
|
exec invokeai --help
|
|
;;
|
|
*)
|
|
echo "Invalid selection"
|
|
exit;;
|
|
esac
|
|
else # in developer console
|
|
python --version
|
|
echo "Press ^D to exit"
|
|
export PS1="(InvokeAI) \u@\h \w> "
|
|
fi
|