Update setup file
This commit is contained in:
parent
0baaf6dc57
commit
109907c6f3
47
setup.sh
47
setup.sh
@ -33,10 +33,10 @@ EOF
|
|||||||
# Checks to see if variable is set and non-empty.
|
# Checks to see if variable is set and non-empty.
|
||||||
# This is defined first, so we can use the function for some default variable values
|
# This is defined first, so we can use the function for some default variable values
|
||||||
env_var_exists() {
|
env_var_exists() {
|
||||||
if [[ ! -v "$1" ]] || [[ -z "$1" ]]; then
|
if [[ -n "${!1}" ]]; then
|
||||||
return 1
|
|
||||||
else
|
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,6 +149,17 @@ Script directory is ${SCRIPT_DIR}." >&5
|
|||||||
PARENT_DIR="$(dirname "${DIR}")"
|
PARENT_DIR="$(dirname "${DIR}")"
|
||||||
VENV_DIR="$DIR/venv"
|
VENV_DIR="$DIR/venv"
|
||||||
|
|
||||||
|
if [ -w "$PARENT_DIR" ] && [ ! -d "$DIR" ]; then
|
||||||
|
echo "Creating install folder ${DIR}."
|
||||||
|
mkdir "$DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -w "$DIR" ]; then
|
||||||
|
echo "We cannot write to ${DIR}."
|
||||||
|
echo "Please ensure the install directory is accurate and you have the correct permissions."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Shared functions
|
# Shared functions
|
||||||
# This checks for free space on the installation drive and returns that in Gb.
|
# This checks for free space on the installation drive and returns that in Gb.
|
||||||
size_available() {
|
size_available() {
|
||||||
@ -213,7 +224,7 @@ install_python_dependencies() {
|
|||||||
|
|
||||||
# Updating pip if there is one
|
# Updating pip if there is one
|
||||||
echo "Checking for pip updates before Python operations."
|
echo "Checking for pip updates before Python operations."
|
||||||
python3 -m pip install --upgrade pip >&3
|
pip install --upgrade pip >&3
|
||||||
|
|
||||||
echo "Installing python dependencies. This could take a few minutes as it downloads files."
|
echo "Installing python dependencies. This could take a few minutes as it downloads files."
|
||||||
echo "If this operation ever runs too long, you can rerun this script in verbose mode to check."
|
echo "If this operation ever runs too long, you can rerun this script in verbose mode to check."
|
||||||
@ -333,8 +344,8 @@ update_kohya_ss() {
|
|||||||
|
|
||||||
echo "Attempting to clone $GIT_REPO."
|
echo "Attempting to clone $GIT_REPO."
|
||||||
if [ ! -d "$DIR/.git" ]; then
|
if [ ! -d "$DIR/.git" ]; then
|
||||||
echo "Cloning and switching to $GIT_REPO:$BRANCH" >*4
|
echo "Cloning and switching to $GIT_REPO:$BRANCH" >&4
|
||||||
git -C "$DIR" clone -b "$BRANCH" "$GIT_REPO" "$(basename "$DIR")" >&3
|
git -C "$PARENT_DIR" clone -b "$BRANCH" "$GIT_REPO" "$(basename "$DIR")" >&3
|
||||||
git -C "$DIR" switch "$BRANCH" >&4
|
git -C "$DIR" switch "$BRANCH" >&4
|
||||||
else
|
else
|
||||||
echo "git repo detected. Attempting to update repository instead."
|
echo "git repo detected. Attempting to update repository instead."
|
||||||
@ -416,17 +427,6 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_storage_space
|
check_storage_space
|
||||||
|
|
||||||
# This is the pre-install work for a kohya installation on a runpod
|
|
||||||
if [ "$RUNPOD" = true ]; then
|
|
||||||
if [ -d "$VENV_DIR" ]; then
|
|
||||||
echo "Pre-existing installation on a runpod detected."
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$VENV_DIR"/lib/python3.10/site-packages/tensorrt/
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$VENV_DIR"/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/
|
|
||||||
cd "$DIR" || exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
update_kohya_ss
|
update_kohya_ss
|
||||||
|
|
||||||
distro=get_distro_name
|
distro=get_distro_name
|
||||||
@ -506,8 +506,17 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|||||||
create_symlinks "$libnvinfer_symlink" "$libnvinfer_target"
|
create_symlinks "$libnvinfer_symlink" "$libnvinfer_target"
|
||||||
create_symlinks "$libcudart_symlink" "$libcudart_target"
|
create_symlinks "$libcudart_symlink" "$libcudart_target"
|
||||||
|
|
||||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VENV_DIR/lib/python3.10/site-packages/tensorrt/"
|
if [ -d "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/" ]; then
|
||||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VENV_DIR/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/"
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VENV_DIR}/lib/python3.10/site-packages/tensorrt/"
|
||||||
|
else
|
||||||
|
echo "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/ not found; not linking library."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/" ]; then
|
||||||
|
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VENV_DIR}/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/"
|
||||||
|
else
|
||||||
|
echo "${VENV_DIR}/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/ not found; not linking library."
|
||||||
|
fi
|
||||||
|
|
||||||
configure_accelerate
|
configure_accelerate
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user