-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathInstall.sh
103 lines (87 loc) · 3.86 KB
/
Install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
echo "Select installation type:"
echo "1. GPU"
echo "2. CPU OR MPS"
read -n 1 -p "Enter number (1 or 2): " choice
echo ""
if [ "$choice" = "2" ]; then
INSTALL_TYPE="CPU"
export BUILD_CUDA_EXT=0
export INSTALL_KERNELS=0
if system_profiler SPDisplaysDataType | grep -q "Metal"; then
echo "MPS is detected. Installing MPS-specific requirements."
MPS_MODE=true
else
MPS_MODE=false
fi
else
INSTALL_TYPE="GPU"
export BUILD_CUDA_EXT=1
export INSTALL_KERNELS=1
MPS_MODE=false
fi
clear
echo "Selected version: $INSTALL_TYPE"
sleep 2
clear
echo "Creating virtual environment..."
python -m venv "$CURRENT_DIR/venv"
source "$CURRENT_DIR/venv/bin/activate"
clear
echo "Setting up local pip cache..."
mkdir -p "$CURRENT_DIR/TechnicalFiles/pip_cache"
export PIP_CACHE_DIR="$CURRENT_DIR/TechnicalFiles/pip_cache"
echo "Upgrading pip, setuptools and wheel..."
python -m pip install --upgrade pip setuptools
pip install wheel
sleep 3
clear
echo "Installing dependencies..."
mkdir -p "$CURRENT_DIR/TechnicalFiles/logs"
ERROR_LOG="$CURRENT_DIR/TechnicalFiles/logs/installation_errors.log"
touch "$ERROR_LOG"
if [ "$INSTALL_TYPE" = "CPU" ]; then
if [ "$MPS_MODE" = true ]; then
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-СPU.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-cuda-CPU.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-llama-cpp-MPS.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-stable-diffusion-cpp-MPS.txt" 2>> "$ERROR_LOG"
else
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-СPU.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-cuda-CPU.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-llama-cpp-CPU.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-stable-diffusion-cpp-CPU.txt" 2>> "$ERROR_LOG"
fi
else
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-cuda.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-llama-cpp.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-stable-diffusion-cpp.txt" 2>> "$ERROR_LOG"
fi
echo "INSTALL_TYPE=$INSTALL_TYPE" > "$CURRENT_DIR/TechnicalFiles/install_config.txt"
pip install triton==3.0.0 2>> "$ERROR_LOG"
pip install --no-build-isolation -e git+https://github.com/PanQiWei/AutoGPTQ.git#[email protected] 2>> "$ERROR_LOG"
pip install --no-build-isolation -e git+https://github.com/casper-hansen/AutoAWQ.git#[email protected] 2>> "$ERROR_LOG"
pip install --no-build-isolation -e git+https://github.com/turboderp/exllamav2.git#[email protected] 2>> "$ERROR_LOG"
pip install git+https://github.com/tencent-ailab/IP-Adapter.git 2>> "$ERROR_LOG"
pip install git+https://github.com/vork/PyNanoInstantMeshes.git 2>> "$ERROR_LOG"
pip install git+https://github.com/openai/CLIP.git 2>> "$ERROR_LOG"
pip install git+https://github.com/xhinker/sd_embed.git@main 2>> "$ERROR_LOG"
sleep 3
clear
echo "Post-installing patches..."
python "$CURRENT_DIR/TechnicalFiles/post_install.py"
sleep 3
clear
echo "Checking for installation errors..."
if grep -iq "error" "$ERROR_LOG"; then
echo "Some packages failed to install. Please check $ERROR_LOG for details."
else
echo "All packages installed successfully."
fi
sleep 5
clear
echo "Application installation process completed. Run start.sh to launch the application."
deactivate
read -p "Press enter to continue"