text-generation-webui/start_macos.sh
Blake Wyatt 6d2c72b593
Add support for MacOS, Linux, and WSL (#21)
* Initial commit

* Initial commit with new code

* Add comments

* Move GPTQ out of if

* Fix install on Arch Linux

* Fix case where install was aborted

If the install was aborted before a model was downloaded, webui wouldn't run.

* Update start_windows.bat

Add necessary flags to Miniconda installer
Disable Start Menu shortcut creation
Disable ssl on Conda
Change Python version to latest 3.10,
I've noticed that explicitly specifying 3.10.9 can break the included Python installation

* Update bitsandbytes wheel link to 0.38.1

Disable ssl on Conda

* Add check for spaces in path

Installation of Miniconda will fail in this case

* Mirror changes to mac and linux scripts

* Start with model-menu

* Add updaters

* Fix line endings

* Add check for path with spaces

* Fix one-click updating

* Fix one-click updating

* Clean up update scripts

* Add environment scripts

---------

Co-authored-by: jllllll <3887729+jllllll@users.noreply.github.com>
Co-authored-by: oobabooga <112222186+oobabooga@users.noreply.github.com>
2023-04-18 02:23:09 -03:00

61 lines
1.9 KiB
Bash

#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
if [[ "$(pwd)" =~ " " ]]; then echo This script relies on Miniconda which can not be silently installed under a path with spaces. && exit; fi
# M Series or Intel
OS_ARCH=$(uname -m)
case "${OS_ARCH}" in
x86_64*) OS_ARCH="x86_64";;
arm64*) OS_ARCH="arm64";;
*) echo "Unknown system architecture: $OS_ARCH! This script runs only on x86_64 or arm64" && exit
esac
# config
INSTALL_DIR="$(pwd)/installer_files"
CONDA_ROOT_PREFIX="$(pwd)/installer_files/conda"
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
MINICONDA_DOWNLOAD_URL="https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-MacOSX-${OS_ARCH}.sh"
conda_exists="F"
# figure out whether git and conda needs to be installed
if "$CONDA_ROOT_PREFIX/bin/conda" --version &>/dev/null; then conda_exists="T"; fi
# (if necessary) install git and conda into a contained environment
# download miniconda
if [ "$conda_exists" == "F" ]; then
echo "Downloading Miniconda from $MINICONDA_DOWNLOAD_URL to $INSTALL_DIR/miniconda_installer.sh"
mkdir -p "$INSTALL_DIR"
curl -Lk "$MINICONDA_DOWNLOAD_URL" > "$INSTALL_DIR/miniconda_installer.sh"
chmod u+x "$INSTALL_DIR/miniconda_installer.sh"
bash "$INSTALL_DIR/miniconda_installer.sh" -b -p $CONDA_ROOT_PREFIX
# test the conda binary
echo "Miniconda version:"
"$CONDA_ROOT_PREFIX/bin/conda" --version
fi
# create the installer env
if [ ! -e "$INSTALL_ENV_DIR" ]; then
"$CONDA_ROOT_PREFIX/bin/conda" create -y -k --prefix "$INSTALL_ENV_DIR" python=3.10
fi
# check if conda environment was actually created
if [ ! -e "$INSTALL_ENV_DIR/bin/python" ]; then
echo "Conda environment is empty."
exit
fi
# activate installer env
source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains about 'shell not initialized' (needed when running in a script)
conda activate "$INSTALL_ENV_DIR"
# setup installer env
python webui.py
echo
echo "Done!"