mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-02-21 01:31:20 +00:00
bugfixes in install scripts
This commit is contained in:
parent
16ad5945f3
commit
df5e2fc95b
@ -135,14 +135,12 @@ if [[ -e "../linux_run.sh" ]]; then
|
||||
echo "Linux run found"
|
||||
else
|
||||
cp linux_run.sh ../
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ -e "../linux_update.sh" ]]; then
|
||||
echo "Linux update found"
|
||||
else
|
||||
cp linux_update.sh ../
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "${gpuchoice^^}" == "B" ]]; then
|
||||
|
@ -39,4 +39,4 @@ CUDA_PATH="$INSTALL_ENV_DIR"
|
||||
|
||||
python app.py "$@"
|
||||
|
||||
pause
|
||||
read -rp "Press Enter to exit..."
|
||||
|
161
macos_install.sh
Normal file
161
macos_install.sh
Normal file
@ -0,0 +1,161 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script will install Miniconda and git with all dependencies for this project.
|
||||
# This enables a user to install this project without manually installing Conda and git.
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [[ "$PWD" == *" "* ]]; then
|
||||
echo "This script relies on Miniconda, which cannot be silently installed under a path with spaces."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "WARNING: This script relies on Miniconda, which will fail to install if the path is too long."
|
||||
|
||||
if [[ "$PWD" =~ [^#\$\%\&\(\)\*\+\] ]]; then
|
||||
echo "WARNING: Special characters were detected in the installation path!"
|
||||
echo " This can cause the installation to fail!"
|
||||
fi
|
||||
|
||||
read -rp "Press Enter to continue..."
|
||||
|
||||
clear
|
||||
|
||||
echo " ___ ___ ___ ___ ___ ___ "
|
||||
echo " /\__\ /\ \ /\__\ /\__\ /\__\ /\ \ "
|
||||
echo " /:/ / /::\ \ /:/ / /:/ / /::| | /::\ \ "
|
||||
echo " /:/ / /:/\:\ \ /:/ / /:/ / /:|:| | /:/\ \ \ "
|
||||
echo " /:/ / /:/ \:\ \ /:/ / /:/ / /:/|:|__|__ _\:\~\ \ \ "
|
||||
echo " /:/__/ /:/__/ \:\__\ /:/__/ /:/__/ /:/ |::::\__\ /\ \:\ \ \__\ "
|
||||
echo " \:\ \ \:\ \ /:/ / \:\ \ \:\ \ \/__/~~/:/ / \:\ \:\ \/__/ "
|
||||
echo " \:\ \ \:\ /:/ / \:\ \ \:\ \ /:/ / \:\ \:\__\ "
|
||||
echo " \:\ \ \:\/:/ / \:\ \ \:\ \ /:/ / \:\/:/ / "
|
||||
echo " \:\__\ \::/ / \:\__\ \:\__\ /:/ / \::/ / "
|
||||
echo " \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ "
|
||||
echo " By ParisNeo"
|
||||
|
||||
echo "Please specify if you want to use a GPU or CPU. Note that only Nvidia GPUs are supported?"
|
||||
echo "A) Enable GPU"
|
||||
echo "B) Run CPU mode"
|
||||
echo
|
||||
read -rp "Input> " gpuchoice
|
||||
gpuchoice="${gpuchoice:0:1}"
|
||||
|
||||
if [[ "${gpuchoice^^}" == "A" ]]; then
|
||||
PACKAGES_TO_INSTALL="python=3.10 cuda-toolkit ninja git gcc"
|
||||
CHANNEL="-c pytorch -c conda-forge"
|
||||
elif [[ "${gpuchoice^^}" == "B" ]]; then
|
||||
PACKAGES_TO_INSTALL="python=3.10 ninja git gcc"
|
||||
CHANNEL="-c conda-forge"
|
||||
else
|
||||
echo "Invalid choice. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Better isolation for virtual environment
|
||||
unset CONDA_SHLVL
|
||||
export PYTHONNOUSERSITE=1
|
||||
unset PYTHONPATH
|
||||
unset PYTHONHOME
|
||||
export TEMP="$PWD/installer_files/temp"
|
||||
export TMP="$PWD/installer_files/temp"
|
||||
|
||||
MINICONDA_DIR="$PWD/installer_files/miniconda3"
|
||||
INSTALL_ENV_DIR="$PWD/installer_files/lollms_env"
|
||||
MINICONDA_DOWNLOAD_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh"
|
||||
REPO_URL="https://github.com/ParisNeo/lollms-webui.git"
|
||||
|
||||
if [ ! -f "$MINICONDA_DIR/Scripts/conda" ]; then
|
||||
# Download Miniconda
|
||||
echo "Downloading Miniconda installer from $MINICONDA_DOWNLOAD_URL"
|
||||
curl -LOk "$MINICONDA_DOWNLOAD_URL"
|
||||
|
||||
# Install Miniconda
|
||||
echo
|
||||
echo "Installing Miniconda to $MINICONDA_DIR"
|
||||
echo "Please wait..."
|
||||
echo
|
||||
bash "Miniconda3-latest-MacOSX-x86_64.sh" -b -p "$MINICONDA_DIR" || ( echo && echo "Miniconda installer not found." && exit 1 )
|
||||
rm -f "Miniconda3-latest-MacOSX-x86_64.sh"
|
||||
if [ ! -f "$MINICONDA_DIR/bin/activate" ]; then
|
||||
echo && echo "Miniconda install failed." && exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Activate Miniconda
|
||||
source "$MINICONDA_DIR/bin/activate" || ( echo "Miniconda hook not found." && exit 1 )
|
||||
|
||||
# Create the installer environment
|
||||
if [ ! -d "$INSTALL_ENV_DIR" ]; then
|
||||
echo "Packages to install: $PACKAGES_TO_INSTALL"
|
||||
conda create -y -k -p "$INSTALL_ENV_DIR" $CHANNEL $PACKAGES_TO_INSTALL || ( echo && echo "Conda environment creation failed." && exit 1 )
|
||||
if [[ "${gpuchoice^^}" == "A" ]]; then
|
||||
conda run --live-stream -p "$INSTALL_ENV_DIR" python -m pip install torch torchvision torchaudio --channel pytorch --channel conda-forge || ( echo && echo "Pytorch installation failed." && exit 1 )
|
||||
elif [[ "${gpuchoice^^}" == "B" ]]; then
|
||||
conda run --live-stream -p "$INSTALL_ENV_DIR" python -m pip install torch torchvision torchaudio --channel pytorch --channel conda-forge || ( echo && echo "Pytorch installation failed." && exit 1 )
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if conda environment was actually created
|
||||
if [ ! -x "$INSTALL_ENV_DIR/bin/python" ]; then
|
||||
echo && echo "Conda environment is empty." && exit 1
|
||||
fi
|
||||
|
||||
# Activate installer environment
|
||||
source activate "$INSTALL_ENV_DIR" || ( echo && echo "Conda environment activation failed." && exit 1 )
|
||||
|
||||
# Set default CUDA toolkit to the one in the environment
|
||||
export CUDA_PATH="$INSTALL_ENV_DIR"
|
||||
|
||||
# Clone the repository
|
||||
if [ -d "lollms-webui" ]; then
|
||||
cd lollms-webui || exit 1
|
||||
git pull
|
||||
else
|
||||
git clone "$REPO_URL"
|
||||
cd lollms-webui || exit 1
|
||||
fi
|
||||
|
||||
# Loop through each "git+" requirement and uninstall it (workaround for inconsistent git package updating)
|
||||
while IFS= read -r requirement; do
|
||||
if echo "$requirement" | grep -q "git+"; then
|
||||
package_name=$(echo "$requirement" | awk -F'/' '{ print $4 }' | awk -F'@' '{ print $1 }')
|
||||
python -m pip uninstall -y "$package_name"
|
||||
fi
|
||||
done < requirements.txt
|
||||
|
||||
# Install the pip requirements
|
||||
python -m pip install -r requirements.txt --upgrade
|
||||
|
||||
|
||||
if [[ -e "../macos_run.sh" ]]; then
|
||||
echo "Macos run found"
|
||||
else
|
||||
cp macos_run.sh ../
|
||||
fi
|
||||
|
||||
if [[ -e "../macos_update.sh" ]]; then
|
||||
echo "Macos update found"
|
||||
else
|
||||
cp macos_update.sh ../
|
||||
fi
|
||||
|
||||
if [[ "${gpuchoice^^}" == "B" ]]; then
|
||||
echo "This is a .no_gpu file." > ../.no_gpu
|
||||
else
|
||||
echo "GPU is enabled, no .no_gpu file will be created."
|
||||
fi
|
||||
|
||||
PrintBigMessage() {
|
||||
echo
|
||||
echo "*******************************************************************"
|
||||
for message in "$@"; do
|
||||
echo "* $message"
|
||||
done
|
||||
echo "*******************************************************************"
|
||||
echo
|
||||
}
|
||||
|
||||
PrintBigMessage "$@"
|
||||
|
||||
exit 0
|
47
macos_run.sh
Normal file
47
macos_run.sh
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
echo "Starting LOLLMS Web UI..."
|
||||
echo " ___ ___ ___ ___ ___ ___ "
|
||||
echo " /\__\ /\ \ /\__\ /\__\ /\__\ /\ \ "
|
||||
echo " /:/ / /::\ \ /:/ / /:/ / /::| | /::\ \ "
|
||||
echo " /:/ / /:/\:\ \ /:/ / /:/ / /:|:| | /:/\ \ \ "
|
||||
echo " /:/ / /:/ \:\ \ /:/ / /:/ / /:/|:|__|__ _\:\~\ \ \ "
|
||||
echo " /:/__/ /:/__/ \:\__\ /:/__/ /:/__/ /:/ |::::\__\ /\ \:\ \ \__\ "
|
||||
echo " \:\ \ \:\ \ /:/ / \:\ \ \:\ \ \/__/~~/:/ / \:\ \:\ \/__/ "
|
||||
echo " \:\ \ \:\ /:/ / \:\ \ \:\ \ /:/ / \:\ \:\__\ "
|
||||
echo " \:\ \ \:\/:/ / \:\ \ \:\ \ /:/ / \:\/:/ / "
|
||||
echo " \:\__\ \::/ / \:\__\ \:\__\ /:/ / \::/ / "
|
||||
echo " \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ "
|
||||
echo " By ParisNeo"
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Better isolation for virtual environment
|
||||
CONDA_SHLVL=""
|
||||
PYTHONNOUSERSITE=1
|
||||
PYTHONPATH=""
|
||||
PYTHONHOME=""
|
||||
TEMP="./installer_files/temp"
|
||||
TMP="./installer_files/temp"
|
||||
INSTALL_ENV_DIR="./installer_files/lollms_env"
|
||||
MINICONDA_DIR="./installer_files/miniconda3"
|
||||
|
||||
if [ ! -f "$MINICONDA_DIR/bin/activate" ]; then
|
||||
echo "Miniconda not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source "$MINICONDA_DIR/bin/activate" "$INSTALL_ENV_DIR"
|
||||
cd lollms-webui
|
||||
|
||||
# Set default CUDA toolkit to the one in the environment
|
||||
CUDA_PATH="$INSTALL_ENV_DIR"
|
||||
|
||||
# Launch the LOLLMS Web UI application
|
||||
python app.py "$@"
|
||||
|
||||
# Pause at the end to keep the terminal window open
|
||||
read -rp "Press Enter to exit..."
|
||||
|
||||
|
||||
|
||||
|
0
macos_update.sh
Normal file
0
macos_update.sh
Normal file
@ -114,14 +114,12 @@ if exist ..\win_run.bat (
|
||||
echo Win run found
|
||||
) else (
|
||||
copy win_run.bat ..\
|
||||
goto end
|
||||
)
|
||||
|
||||
if exist ..\win_update.bat (
|
||||
echo Win update found
|
||||
) else (
|
||||
copy win_update.bat ..\
|
||||
goto end
|
||||
)
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
@ -135,6 +133,8 @@ if /I "%gpuchoice%"=="B" (
|
||||
|
||||
endlocal
|
||||
|
||||
goto end
|
||||
|
||||
:PrintBigMessage
|
||||
echo. && echo.
|
||||
echo *******************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user