Skip to content

Commit

Permalink
MAC-OS-SUPPORT-UPD
Browse files Browse the repository at this point in the history
  • Loading branch information
Dartvauder committed Nov 5, 2024
1 parent 344eae5 commit 2eac4cc
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 10 deletions.
23 changes: 19 additions & 4 deletions Install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ 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
Expand Down Expand Up @@ -44,10 +52,17 @@ ERROR_LOG="$CURRENT_DIR/TechnicalFiles/logs/installation_errors.log"
touch "$ERROR_LOG"

if [ "$INSTALL_TYPE" = "CPU" ]; 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-CPU.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-stable-diffusion-cpp-CPU.txt" 2>> "$ERROR_LOG"
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"
Expand Down
2 changes: 1 addition & 1 deletion RequirementsFiles/requirements-llama-cpp-CPU.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
llama-cpp-python==0.3.1
llama-cpp-python==0.3.1 -C cmake.args="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
1 change: 1 addition & 0 deletions RequirementsFiles/requirements-llama-cpp-MPS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
llama-cpp-python==0.3.1 -C cmake.args="-DGGML_METAL=on"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
stable-diffusion-cpp-python==0.2.1
stable-diffusion-cpp-python==0.2.1 -C cmake.args="-DGGML_OPENBLAS=ON"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stable-diffusion-cpp-python==0.2.1 -C cmake.args="-DSD_METAL=ON"
23 changes: 19 additions & 4 deletions Update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,34 @@ touch "$ERROR_LOG"
if [ "$INSTALL_TYPE" = "CPU" ]; then
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
export BUILD_CUDA_EXT=1
export INSTALL_KERNELS=1
MPS_MODE=false
fi

python3 -m pip install --upgrade pip setuptools
pip install wheel

if [ "$INSTALL_TYPE" = "CPU" ]; 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-CPU.txt" 2>> "$ERROR_LOG"
pip install --no-deps -r "$CURRENT_DIR/RequirementsFiles/requirements-stable-diffusion-cpp-CPU.txt" 2>> "$ERROR_LOG"
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"
Expand Down

0 comments on commit 2eac4cc

Please sign in to comment.