-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·44 lines (39 loc) · 1 KB
/
setup.sh
File metadata and controls
executable file
·44 lines (39 loc) · 1 KB
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
#!/bin/bash
BUILD_TYPE=$1
CMAKE_ARGS=
# Setup virtual environment
echo "Setting up virtual environment..."
python3 -m venv .venv
source .venv/bin/activate
# Figure out the build type
echo "Detecting build type..."
unamestr=$(uname)
if [[ $BUILD_TYPE == "" ]]; then
if [[ "$unamestr" == "Darwin" ]]; then
BUILD_TYPE="metal"
else
amd=$(lspci | grep -i amd)
nvidia=$(lspci | grep -i nvidia)
if [[ "$nvidia" != "" ]]; then
BUILD_TYPE="cublas"
elif [[ "$amd" != "" ]]; then
BUILD_TYPE="hipblas"
else
BUILD_TYPE="openblas"
fi
fi
fi
# Set up build type and CMake arguments
echo "Setting up build type..."
if [ "$BUILD_TYPE" = "cublas" ]; then
CMAKE_ARGS+="-DGGML_CUDA=ON"
elif [ "$BUILD_TYPE" = "hipblas" ]; then
CMAKE_ARGS+="-DGGML_HIPBLAS=on"
elif [ "$BUILD_TYPE" = "metal" ]; then
CMAKE_ARGS+="-DGGML_METAL=ON"
else
CMAKE_ARGS+="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
fi
# Install dependencies
echo "Installing dependencies..."
pip3 install -r requirements.txt