InvokeAI/installer/templates/invoke.sh.in
Lincoln Stein 714fff39ba add new console frontend to initial model selection, and other improvements
1. The invokeai-configure script has now been refactored. The work of
   selecting and downloading initial models at install time is now done
   by a script named invokeai-initial-models (module
   name is ldm.invoke.config.initial_model_select)

   The calling arguments for invokeai-configure have not changed, so
   nothing should break. After initializing the root directory, the
   script calls invokeai-initial-models to let the user select the
   starting models to install.

2. invokeai-initial-models puts up a console GUI with checkboxes to
   indicate which models to install. It respects the --default_only
   and --yes arguments so that CI will continue to work.

3. User can now edit the VAE assigned to diffusers models in the CLI.

4. Fixed a bug that caused a crash during model loading when the VAE
   is set to None, rather than being empty.
2023-02-12 23:52:44 -05:00

80 lines
2.2 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. re-run the configure script to fix a broken install"
echo "6. download more starter models from HuggingFace"
echo "7. open the developer console"
echo "8. command-line help "
echo ""
read -p "Please enter 1, 2, 3, 4, 5, 6, 7 or 8: [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 invokeai-ti --gui $@
;;
4)
echo "Merging Models:"
exec invokeai-merge --gui $@
;;
5)
exec invokeai-configure --root ${INVOKEAI_ROOT}
;;
6)
exec invokeai-initial-models --root ${INVOKEAI_ROOT}
;;
7)
echo "Developer Console:"
file_name=$(basename "${BASH_SOURCE[0]}")
bash --init-file "$file_name"
;;
8)
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