this is release candidate 2.3.3-rc1

Incorporates a modified version of the dialog-based invoke.sh script
suggested by JoshuaKimsey:
https://discord.com/channels/1020123559063990373/1089119602425995304
This commit is contained in:
Lincoln Stein 2023-03-25 16:58:08 -04:00
parent 610a1483b7
commit 1cb88960fe

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# coauthored by Lincoln Stein, Eugene Brodsky and JoshuaKimsey
# Copyright 2023, The InvokeAI Development Team
#### ####
# This launch script assumes that: # This launch script assumes that:
# 1. it is located in the runtime directory, # 1. it is located in the runtime directory,
@ -18,18 +21,109 @@ cd "$scriptdir"
. .venv/bin/activate . .venv/bin/activate
export INVOKEAI_ROOT="$scriptdir" export INVOKEAI_ROOT="$scriptdir"
PARAMS=$@
# set required env var for torch on mac MPS # set required env var for torch on mac MPS
if [ "$(uname -s)" == "Darwin" ]; then if [ "$(uname -s)" == "Darwin" ]; then
export PYTORCH_ENABLE_MPS_FALLBACK=1 export PYTORCH_ENABLE_MPS_FALLBACK=1
fi fi
if [ "$0" != "bash" ]; then do_choice() {
case $1 in
1)
echo "Generate images with a browser-based interface"
clear
invokeai --web $PARAMS
;;
2)
echo "Generate images using a command-line interface"
clear
invokeai $PARAMS
;;
3)
echo "Textual inversion training"
clear
invokeai-ti --gui $PARAMS
;;
4)
echo "Merge models (diffusers type only)"
clear
invokeai-merge --gui $PARAMS
;;
5)
echo "Download and install models"
clear
invokeai-model-install --root ${INVOKEAI_ROOT}
;;
6)
echo "Change InvokeAI startup options"
clear
invokeai-configure --root ${INVOKEAI_ROOT} --skip-sd-weights --skip-support-models
;;
7)
echo "Re-run the configure script to fix a broken install"
clear
invokeai-configure --root ${INVOKEAI_ROOT} --yes --default_only
;;
8)
echo "Open the developer console"
clear
file_name=$(basename "${BASH_SOURCE[0]}")
bash --init-file "$file_name"
;;
9)
echo "Update InvokeAI"
clear
invokeai-update
;;
10)
echo "Command-line help"
clear
invokeai --help
;;
*)
echo "Exiting..."
exit
;;
esac
clear
}
do_dialog() {
while true
do
options=(
1 "Generate images with a browser-based interface"
2 "Generate images using a command-line interface"
3 "Textual inversion training"
4 "Merge models (diffusers type only)"
5 "Download and install models"
6 "Change InvokeAI startup options"
7 "Re-run the configure script to fix a broken install"
8 "Open the developer console"
9 "Update InvokeAI"
10 "Command-line help")
choice=$(dialog --clear \
--backtitle "InvokeAI" \
--title "What you like to run?" \
--menu "Select an option:" \
0 0 0 \
"${options[@]}" \
2>&1 >/dev/tty) || clear
do_choice "$choice"
done
clear
}
do_line_input() {
echo " ** For a more attractive experience, please install the 'dialog' utility. **"
echo ""
while true while true
do do
echo "Do you want to generate images using the" echo "Do you want to generate images using the"
echo "1. command-line interface" echo "1. browser-based UI"
echo "2. browser-based UI" echo "2. command-line interface"
echo "3. run textual inversion training" echo "3. run textual inversion training"
echo "4. merge models (diffusers type only)" echo "4. merge models (diffusers type only)"
echo "5. download and install models" echo "5. download and install models"
@ -40,56 +134,22 @@ if [ "$0" != "bash" ]; then
echo "10. command-line help" echo "10. command-line help"
echo "Q - Quit" echo "Q - Quit"
echo "" echo ""
read -p "Please enter 1-10, Q: [2] " yn read -p "Please enter 1-10, Q: [1] " yn
choice=${yn:='2'} choice=${yn:='1'}
case $choice in do_choice $choice
1)
echo "Starting the InvokeAI command-line..."
invokeai $@
;;
2)
echo "Starting the InvokeAI browser-based UI..."
invokeai --web $@
;;
3)
echo "Starting Textual Inversion:"
invokeai-ti --gui $@
;;
4)
echo "Merging Models:"
invokeai-merge --gui $@
;;
5)
invokeai-model-install --root ${INVOKEAI_ROOT}
;;
6)
invokeai-configure --root ${INVOKEAI_ROOT} --skip-sd-weights --skip-support-models
;;
7)
invokeai-configure --root ${INVOKEAI_ROOT} --yes --default_only
;;
8)
echo "Developer Console:"
file_name=$(basename "${BASH_SOURCE[0]}")
bash --init-file "$file_name"
;;
9)
echo "Update:"
invokeai-update
;;
10)
invokeai --help
;;
[qQ])
exit 0
;;
*)
echo "Invalid selection"
exit;;
esac
done done
}
if [ "$0" != "bash" ]; then
# Dialog seems to be a standard installtion for most Linux distros, but this checks to ensure it is present regardless
if command -v dialog &> /dev/null ; then
do_dialog
else
do_line_input
fi
else # in developer console else # in developer console
python --version python --version
echo "Press ^D to exit" echo "Press ^D to exit"
export PS1="(InvokeAI) \u@\h \w> " export PS1="(InvokeAI) \u@\h \w> "
fi fi